I would like to shoot a ray from a box that’s moving.
Am I supposed to create a ray:
var ray = new BABYLON.Ray(origin,direction,length);
for every frame ?
Is there a way to have the ray updates with the mesh.
1 Like
Hi @aekiro
Yes, you have to update the ray. You can do it before rendering for example, using
https://doc.babylonjs.com/api/classes/babylon.scene#registerbeforerender
2 Likes
2 Likes
Thanks. Your example is done with rayhelper though which is different.
I tried to do it with just the ray() method, But it does not seem to work:
https://www.babylonjs-playground.com/#ZHDBJ#51
Can you please have a look at what’s wrong in my code ?
1 Like
the ray direction wasn’t good.
2 Likes