#How do I use transform scale in Visual scripting?
1 messages · Page 1 of 1 (latest)
So this is supposed to work?
Is onTriggerStay updating every frame?
no, but Timer makes its own little routine
ive never used this node, but i think this is how it works
Dont use local scale unless its a child of a parent object
yeah, wont suggest copying my graph, but the pieces are there
Oh mb
but tbh i would use animation to do this, unless your brief specifically says you have to transform with code
So wait what am I supposed to use then
well the key takeaway above is how the timer node works
do whatever you want with it though
in that example it goes for 1 sec
and you can use the % as 0 to 1 value for your lerp
Oh I see
i cant say for sure what you will plug it into
but yeah I would use animation for this, and set boolean on the animator
Use remaining % because that goes from 1 to 0.
Multiply that with get scale and that shrinks object to 0.
See if this video inspires a solution for you
In this Unity 2021 beginner tutorial I show how to setup an animator controller for a simple model we created with Blender that has skeletal animations. I add two triggers to activate the states for the animation (open and close) and then I write a C# script that uses the attached Animator controller to play the animations when the Keys O or C a...
If you want to limit not going to 0, you can use a clamp node that connects remaining % as input.
And go min 0.5 and max 1.
So it stays at half the size.
There's more ways to do this btw.
Something like this?
Animation is like the easiest and has more control over that behavior. But if you need to do it via coding well here's one way
But thats not the node? Hmm it needs the middle to say "this". Not 0,0,0
Oh
I'll wait till you get success with this before elaborating slightly on the anim approach, cos for your paper it is probably better to learn the code approach anyway
no lossy scale?
wow i also cant see SetLossyScale
oh its only getLossyScale
you do run into that on occasion with UVS, it has most things but not all things
So are there any alternative scales to use?
local is probably fine, just be aware it will be relative to its parent
if it has no parent it will just use global/lossy
Oh I don't think it has one
Names of the node. Unchecking human naming helps 120%!
yeah, can confirm, in this case UVS just has no setter for lossy
I think I'm missing something here
one thing might be strange there
its always multiplying by its current scale
you probably want a fixed max scale value to multiply by instead
run the numbers for a moment, 90% of 1 is .9, 80% of 1 is .8, etc etc
Yea nothing is happening when I touch the sphere
but 90% of current scale would be... .9, and then on the next frame it will be 80%, but not 80% of initial scale, 80% of current scale, which will actually be 80% of .9, this will cause a sortof exponential effect
This is what I did btw
and you confirm your sphere is set to trigger? and that 1 of the 2 colliders has a non kinematic rigidbody?
physX is good but with game physics we have to always assume a margin of error
it's possibly that because there are 2 colliders with identical radius, overlap never happens
the first collider there might be blocking you from overlapping with the trigger
Thats a good point but nothing really changed once I fixed it
0.6 radius for trigger collider
cant say for sure though, you will generally find consistent tests wont yield consistent results with physics lol
this is partly because of framerate etc
Oof
but yeah it should work what you have
What about player
does player have a rigidbody?
Maybe something wrong with it?
Good question actually lol, I'm using firstPersonStarter for this assignment because that was what was instructed
i cant remember but i used to use a downloaded asset for teaching classes and it came with a CharacterController version, as well as a Rigidbody version
This is what I was given
iirc there is some additional steps to take if you are using CC
Oh I think I am
Ah, CharacterController
check over the docs page for Enter
https://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html
They've actually changed their docs since last I saw
it used to explicitly say one of the 2 colliders has to be a non-kinematic rigidbody, now it just "implies it" lol
It's not saying if its possible to make it trigger but the docs says there are messages associated wtih Character Controller 🙃
you need OnControllerColliderHit apparently
Really?
i haven't used CC for years lol, someone else might better guide there
Imma just try replcing the event and see what happens
how on earth do ppl get enter/exit events from this though?
So this didn't in fact work
Hopefully someone else can weigh in here, it's been too long since I last touched CC
Honestly I might just reuse the code from the moving platform and use it for shrinking instead, I'll just take whatever grade atp 🙏
Trust Google AI at your discretion lol
With what isTrigger property 😭 It doens't even exist
it might mean for the collider attached to the same object as charactercontroller
or it is AI and it means nothing at all lol
btw, if you ever did offload the scale transitions to animation, your UVS graph becomes this... or whatever the characterController equivalent to that is
i abandoned CC years ago because working with these exact things is really tedious
Rigidbody has its own problems of course, but generally I prefer solving those than CC's problems
Yea its really starting to show
Honestly at this point I might just reuse the other code and repurpose for scale, thank you so much for your help otherwise ❤️
for sure, hopefully someone else can shed light on the CC approach too in the meantime
try just dropping a kinematic rigidbody on your character controller lol
i dont think you have to add a collider to character, the characterController itself is already one
Its true sorry wasnt paying much attention 🤪 flu got my brain full of mucus
Can be Float 1 multiplied by cooldown %
able to shrink a sphere while they are staying on it and have it reset on trigger leave.
OH! didnt read this... I'll make a graph tomorrow when im on my computer and show you how it can be done. 2x ways: via visual script and via animation (that also goes into uVS)
Sorry - i dont work on sundays 😛
Is this one the Character? because i imagine you need on controller collider hit would need to be on the GameObject with the character controller. I have not used Character controller but just seems like that
Then you could use a custom event on the Sphere to tell it to shrink but I imagine that you still have no way of checking on exit
Timer and cooldown are my favorites. I'll soon show how this can be done.
@mellow fable would help if you an illustration because "player to be able to shrink a sphere while they are staying on it"
That means..
-
player is close?
-
Player steps on it?
So a quick draw helps