Pryme8 Posted August 14, 2016 Share Posted August 14, 2016 http://www.babylonjs-playground.com/#1SROXL#0 I am super confused as to why my mesh is just bouncing like this... even with restitution set to 0. Also when I run this on my local client it acts way different. the player sits on the ground and acts the way it should. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 15, 2016 Share Posted August 15, 2016 Hi Any chance for a SIMPLE playground that reproduces the issue? It looks like you are mixing the BJS built-in collision system, with physics engine. (lines 26/27 unneeded, I believe). Also, if you indent properly, all is easier to read. And... can you keep all your beforeRender things in a single func? http://www.babylonjs-playground.com/#1SROXL#1 There. I remarked-out all the "stuff", and now the tube drops nicely, falls to the ground, with no bounce. http://www.babylonjs-playground.com/#1SROXL#3 Another. Got a little bounce, not much. And I was able to re-activate your primary beforeRender func, but lines 229/230 are causing tube movement without keypresses. Maybe this will give you something to work-with. Hope so. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2016 Author Share Posted August 15, 2016 wrong tube. the one tube is just a point of reference, the real tube that should have physics being applied to it is the one that has the camera parented to it. I know it seems kinda backwards to use the physics engine, but not use it... but once I establish my raycasting it will all make since. I can make the point of reference tub act correct if I add physics but that's not what I need. One second let me make a video.... Also, if I change the ground planes imposter to a mesh imposter (which I am going to need) the player tube drops right through... this may be something that changes when I run it on the playground as well though, I have not checked. Why is there a difference between what happens on my local client to what happens on the playground like constantly? Its making development really hard... Im am pretty sure I have the most up to date versions ill double check though, maybe ill just start grabbing from the CDN and that will fix some problems o_O. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2016 Author Share Posted August 15, 2016 ***EDIT, I stand corrected on it being Cannon... its when I changed to the BJS on the CDN that I get the freakout. Found it: scene.registerBeforeRender(function(){ camera.position = v3(player_box.position.x,player_box.position.y+2,player_box.position.z); //camera.position.y+=2; }); why would this make the physics system freak out? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2016 Author Share Posted August 15, 2016 http://www.babylonjs-playground.com/#XFRMS#0 well it works now... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 15, 2016 Share Posted August 15, 2016 What was not working? (Sorry trying to catch up:)) Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2016 Author Share Posted August 15, 2016 For some reason having my cameras y position have 2 added to it after it was set to the position of the player was causing some really weird behavior. Which was only the case when I was running the most current version of BJS. Not sure what caused the different behavior but it was odd. Now if I could just get mesh colliders working haha ^_^. Im about to just scrap the whole physics engine and just do a raycasting engine. Starting to think, why compare mesh vertices at ... Also why is there no mesh.body.setVelocity(x,y,z); function? The only way to manipulate the velocity manually is by direct identifiers ie: mesh.body.velocity.x = 1.0; mesh.body.velocity.... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 15, 2016 Share Posted August 15, 2016 *shrug* I think you can do things like body.linearVelocity = new OIMO.Math.Vector3(x, y, z); Same with angularVelocity, for spin. Cannon is probably similar. Didn't test code... but its SIMILAR to what I did above. Oimo... hmm... it used to be mesh.body.body... that's where all the good stuff was. With Cannon... just mesh.body. Write objects out to JS console, then click on the object... to get the object inspector to launch. Then you can see all the methods and props on mesh.body and mesh.body.body, depending upon which engine you are using. But yeah, you get those darned physics package authors on the phone and give them a piece of your mind, for sure. Straighten 'em up... make them fly right. Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 15, 2016 Share Posted August 15, 2016 Notice that you also changed the restitution from 0 to 0.0001 , which is probably the main reason for it working correctly. It is very hard for me to debug your scene due to many reasons (events not being disposed, code I cannot sadly follow), but my first guess would be that the default values of restitution are being set, when 0 is being provided, as 0 is false in javascript. which is a bug that is probably due to my mistake I will look into that. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2016 Author Share Posted August 15, 2016 1 hour ago, Wingnut said: *shrug* I think you can do things like body.linearVelocity = new OIMO.Math.Vector3(x, y, z); Same with angularVelocity, for spin. Cannon is probably similar. Didn't test code... but its SIMILAR to what I did above. Oimo... hmm... it used to be mesh.body.body... that's where all the good stuff was. With Cannon... just mesh.body. Write objects out to JS console, then click on the object... to get the object inspector to launch. Then you can see all the methods and props on mesh.body and mesh.body.body, depending upon which engine you are using. But yeah, you get those darned physics package authors on the phone and give them a piece of your mind, for sure. Straighten 'em up... make them fly right. Oh man I totally forgot you can do that... do you have the playground with the three balls in the containers that I did that with and applied different styles of velocity manipulation? I cant find it but if memory serves me, it was done in that, and I figured your the guy to ask with your playgrounds that you have saved. 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.