[SOLVED] Cannot set entity position with rigidbody

Hi everyone, newbie dev here.

I am currently making a decoration mechanic for my project, the way i set it up is by pressing a button it will spawn a template object that follows the mouse then if i press the middle mouse button the object is “set” by making it not follow the mouse anymore.

So far this is working as intended even with the collision component, but when i add the rigidbody component, the object does not follow the mouse when spawned instead it set itself down to a position.

My current workaround is disabling the rigidbody while the object is following the mouse, which worked, but when i press the middle mouse button it sets itself down to a position similar to the one it was spawned in. Is there any way to solve the problem? if possible i prefer the disabling rigidbody while following the mouse so there would be no obstruction while setting up the object.

My project: PlayCanvas | HTML5 Game Engine

Thanks in advance!

Perhaps setting the rigidbody to kinematic?

You can use the
entity.rigidbody.teleport(pos)
function to move the rigidbody similar to a regular entity. It takes in a vec3 for the position.
Rigidbody Teleport Function.

3 Likes

Hi everyone, turns out the problem is caused because i used the wrong coordinates for the position,

Thank you guys for your help!

also i seem to cannot edit this post to be [solved] hopefully the mods can help

1 Like

So I was actually correct for once? Yay. Also @yaustar mark this as solved plz.

Done! :ok_hand: