Hello,
I am trying to move a kinematic body with the following code:
Nothing happens. Same if it is set to trigger or static. The only time it moves is when it is set to Dynamic.
Why is it not moving?
Thanks!
Hello,
I am trying to move a kinematic body with the following code:
Nothing happens. Same if it is set to trigger or static. The only time it moves is when it is set to Dynamic.
Why is it not moving?
Thanks!
Try changing this:
go.set_position(pos.y)
to this:
go.set_position(pos)
…alternatively:
go.set(".", "position.y", pos.y)
You should get an error in console, saying that the first argument is a number and not a vector?
Interesting. I should indeed. But I don’t. And it works when the type is set to Dynamic. At least it looks like it works because it is moving on the Y axis.
I tried fixing the error:
go.set_position(pos)
and I tried
go.set(".", “position.y”, pos.y)
Neither of them work.
That’s the difference between dynamic and the rest, it updates each frame with the given gravity.
Is the script running?
Aah! I now found the error. I added a print statement. It seems the script, which ran the Update() method was removed somehow. I added it back and all is good now.
I really thought the script did its job because it was moving exactly like I wrote it to move (or at least I thought it did). But it was because it had gravity enabled.
Thanks!