amorgan Posted March 15, 2016 Share Posted March 15, 2016 I am moving a projectile through space and have registered an OnIntersectionEnterTrigger action to the object and my target. The problem I am facing is that at lower fps, the intersect is sometimes missed due to the object not occupying the same space in a frame because of "skipping". Is there an easy way to interpolate if the object would have intersected via Babylon JS? Or is there a better way to do this? Thank you. Quote Link to comment Share on other sites More sharing options...
Carharttguy Posted March 15, 2016 Share Posted March 15, 2016 Hello You can use RayCasting for this matter. But only if your projectile is moving in a straight line. If it is, use http://doc.babylonjs.com/classes/2.3/Scene#pickwithray-ray-predicate-fastcheck-rarr-pickinginfo-classes-2-3-pickinginfo- this. Cheers Mathias Quote Link to comment Share on other sites More sharing options...
amorgan Posted March 15, 2016 Author Share Posted March 15, 2016 Thanks for the suggestion. I will keep this in mind if I end up doing an interpolation between the last known point and the current point (which should be relatively straight if the time step is small enough, even for a non-linear path). I was hoping there was a Babylon JS feature that could solve this within the Action Manager I wanted to double check before I starting exploring other avenues. Quote Link to comment Share on other sites More sharing options...
amorgan Posted March 17, 2016 Author Share Posted March 17, 2016 Are there any further suggestions for this? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 18, 2016 Share Posted March 18, 2016 THis is probably stupid but why not using physics for this task? Quote Link to comment Share on other sites More sharing options...
amorgan Posted March 18, 2016 Author Share Posted March 18, 2016 Not a stupid question. To be honest, I have not messed with the physics plugins yet. Maybe that is what I am missing. I have just been manipulating my meshes with my own "physics" function. I see there is the Oimi.js and Cannon.js plug-in (or I could use my own). Where is the best place to start for learning how this works? Are the two blogs on the doc site where I should start? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 18, 2016 Share Posted March 18, 2016 Yep..@raananW is also working hard on improving the system (looks for Physics in playground search for dozen of examples) amorgan 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.