Hello !!
I have both, a plain old GameObject (a VR hand) and an instantiated Entity on the scene (a baseball bat entity with PhysicsBody to “Kinematic” and a PhysicsShape).
I have the Entity to always match the position and rotation of the GameObject inside an Update method. However, when swinging the VR hand too fast and hitting a ball (another Entity), physics work a bit weird as the ball doesn’t go flying towards my swing direction but does some erratic movements (as if the collision detection was discrete). If I swing the bat slowly however, the physics seem to work just fine.
I’m doing the position update as follows:
private void Update()
{
// Go: GameObject
_entityManager.SetComponentData(entity, new Translation { Value = Go.position });
_entityManager.SetComponentData(entity, new Rotation { Value = Go.rotation });
}
I know that, for GameObjects using a RigidBody, I shouldn’t change the transform.position values directly as the physics won’t work as expected. I’m guessing this is the same for Entities (discrete vs continuous collision detection). However, do you know of a way for an Entity to match a GameObject position and rotation every frame and have physics work as expected ?
Thanks a lot for your help beforehand !