Gryphon_de Posted October 11, 2011 Posted October 11, 2011 Hello! I have player spectator on position1. I need to move it to position2 as soon as possible, but I can't use setWorldPosition() method since in this case any collision influence will be ignored. How can I do this?
alexei.garbuzenko Posted October 11, 2011 Posted October 11, 2011 +1 to this question. How can we move physics-enabled bodies with specified trajectory but with full collision, gravity, etc. calculation?
Guest anet Posted October 12, 2011 Posted October 12, 2011 Use Body::setPreserveTransform method for this purpose. See https://developer.unigine.com/en/docs/1.0/code/scripting/library/physics/class.body#setPreserveTransform_mat4 for reference. In case of physical PlayerActor it will look in the following way: Body body = player_actor.getBody(); body.setPreserveTransform(new_transform);
Guest anet Posted October 12, 2011 Posted October 12, 2011 PlayerSpectator has no body inside it and its collision behavior is much simpler. So you can just apply transform and call updateControls() to recalculate collisions.
Recommended Posts