”rotating a vector3f” cast ray picking object hit WORLD position


EDIT: col.getWorldContactPoint(); works! done!!

EDIT: the code below to rotate the vector3f is still usefull to get a normal from a cast ray hit face, and rotate it based on the physics rotation of the object, to properly position a moving spotlight near it!!

I cast a ray to pick object.

I found that the position it hits on object is relative to the object.

Also that position is not rotated as the PhysicsNode is.

So I created this code to find the exact position it hits the object but in the world, and there I position a marker.

But I dont like it and I think it can be slow.

So I believe there is a simple way to calculate that, but I have no more ideas where to look at.

Any tips?

Obs.: I still cant understand the quaternion thing, I am used to angles etc…

posHit = castRay collision getContactPoint();

geom = collision getGeometry();

Node nodePosHit = new Node();


Node nodeToRotate = new Node();





Vector3f posHitWorld = geom.getWorldTranslation().add(posHit);