Pryme8 Posted August 28, 2018 Share Posted August 28, 2018 Is there a way to fire a function anytime a specific body touches any other physicsImposter? I got it for the imposters that are in the scene when the event is bound, but there will be situations where I need it to be more dynamic. mesh.body.registerOnPhysicsCollide(scene.getPhysicsEngine()._impostors, hit) Quote Link to comment Share on other sites More sharing options...
Guest Posted August 29, 2018 Share Posted August 29, 2018 That is a question for @RaananW Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 29, 2018 Author Share Posted August 29, 2018 The trouble is unregistered it as well o_O, but ehh I think I found a "work around" for now. Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 30, 2018 Share Posted August 30, 2018 Come on my buddy, haven't you used collision detection? then account for the physics. Simple. DB Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 30, 2018 Author Share Posted August 30, 2018 Yeah, how the hell did I fire callbacks on every collision? You are right I did figure this out already I'm just drawing a blank now and I don't think I have access to the script anymore. Do I still have ftp access to your server? Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 30, 2018 Share Posted August 30, 2018 There's no current access, but I can zip and send the app to you. Message me your email, as I have a new computer and haven't updated my contacts. DB Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 10, 2018 Share Posted September 10, 2018 god, sorry for the late response. Any luck getting to a point you are happy with? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted September 10, 2018 Author Share Posted September 10, 2018 Yes sir ^_^, but still dont have a truly Dynamic solution. Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 10, 2018 Share Posted September 10, 2018 i might need you to explain it again, i didnt understand what you meant in the first post. Sorry Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted September 11, 2018 Author Share Posted September 11, 2018 So how do I make the 'mesh.body.registerOnPhysicsCollide()' function work without providing an array or body for the function to fire in response to. Basically just like a global every time a physics body touches any other physics body do this method, there has to be one I just cant find it. like a physicsEngine.registerOnAnyCollide() Quote Link to comment Share on other sites More sharing options...
DylanD Posted September 11, 2018 Share Posted September 11, 2018 54 minutes ago, Pryme8 said: So how do I make the 'mesh.body.registerOnPhysicsCollide()' function work without providing an array or body for the function to fire in response to. Basically just like a global every time a physics body touches any other physics body do this method, there has to be one I just cant find it. like a physicsEngine.registerOnAnyCollide() couldnt you just provide an array of all the meshes in the scene then. Use scene.meshes?? to make it would for each one just scene.meshes.foreach(mesh)=>{ if(mesh.body.registerOnPhysicsCollide(scene.meshes)){ console.log(mesh.name); } } sorry this was kind of rush but why not that, seems general enough, right? edit: i know you didnt want to put an array in but this is the next best thing right? gotta reference them somehow edit2: there is probably a better way i just dont know of Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted September 11, 2018 Author Share Posted September 11, 2018 I already do that, basically with the mesh.body.registerOnPhysicsCollide(scene.getPhysicsEngine()._impostors, hit) but I have times where the imposters change quite often so the array from scene.getPhysicsEngine()._impostors is only be correct for a short period of time. I found a work around but figured it the collisions are firing through the engine when ever a any imposter touches that there should be a way to tie into that event. 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.