Is there any way for me to do a ray-cast to a RigidBody and find out exactly what global location that it collided with the object’s collision shape? The rayCast function is essentially what I need except I need to know where it hit the object in world coordinates ( or any other coordinates if possible ), not just the object that it hit?
This is not available for nodes logic.
You can add some issue on Github to get contact position and normal exposed as new functions.
I don’t need it for nodes. Is there a way to do it in the Haxe API do you know?
Use this code
In line 33 replace that with this-> trace(rb.object.transform.loc);
I recommend you to clone the repo because there are many examples.
You can also do this with node.
Edit:Code doesn’t work, try using node.
Use this for node setup
This will print you location of object its ray touches to.
Raycast output is an object that is hit like some box model or some new object representing the raycast impact ?
Because the node “Get location” has nothing to do with raycast, it gives you an object world location.
So I was just looking at the code for the “Cast Physics Ray” node and it looks like that “Hit” output is what I’m looking for. It is apparently a property of the
armory.trait.physics.bullet.PhysicsWorld class. I haven’t tried it out just yet, but that looks like exactly what I’m looking for.
Perhaps you can make a new node.
I agree Armory needs a Ray Hit output for Raycast with minimum :
- location hit
- normal direction hit
- object name