Felix Bytow Posted January 8, 2014 Share Posted January 8, 2014 Hi there... so here are actually 2 questions: 1. How would I do 2D physics? My game is 3D but with a flat ground and a top-down-camera... There is no jumping or anything so movement should only happen on x and z axis. I tried moving a box entitiy using AddForce and just moving it along the z axis (which works fine), but as soon as it hits e.g. a wall it bounces off and suddenly there is also y movement :/ How can I disable the y axis for physics? 2. Somehow related to 1... When the box hits a wall in an angle of 90 degree it should bounce off without turning to the side (atleast I would expect that), but it seems to bounce off randomly to the side. But what I would want even more is to disable the bouncing completely for that type of collision (this box hits any wall), but I coudn't really find a command to do so. How can I disable the bouncing on collision? I hope someone can help me :-) Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 8, 2014 Share Posted January 8, 2014 You can try SetPosition to manually set Y back to 0 or put an invisible "ceiling" above. But I really would love to see 2D locked properly by an official physics command. So many people try to do various 2D games with 3D models. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 8, 2014 Share Posted January 8, 2014 When using physics you should really use PhysicsSetPosition rather SetPosition. 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 8, 2014 Share Posted January 8, 2014 Ah yes, Aggror's right. Quote Link to comment Share on other sites More sharing options...
bandrewk Posted January 8, 2014 Share Posted January 8, 2014 When using physics you should really use PhysicsSetPosition rather SetPosition. Could you please explain why one should prefer PhysicsSetPosition over SetPosition ? Quote Link to comment Share on other sites More sharing options...
tjheldna Posted January 8, 2014 Share Posted January 8, 2014 PhysicsSetPosition dosent disrupt things like gravity. So say if you are always setting a physics body to the z axis using PhysicsSetPosotion every loop you will still fall and be effected by forces. I wanted to make a side scroller and still do, but I ran into a major problem. Rigid bodies it works for, character controllers it does not (I think you can set it but it has no effect). If you do a search On the forums there is a thread on different methods tried. The only thing that did work were two invisible boxes either side of the player, which I thought was too hacky. Another possibility would be to create your own character controller out of a rigid body. Would be real nice if the character controller had the ability to do this too. I would be a big +1 on that. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 8, 2014 Share Posted January 8, 2014 If you do a search On the forums there is a thread on different methods tried. He's not a developer so he can't. The only thing that did work were two invisible boxes either side of the player, which I thought was too hacky. I did the same with mine and I agree. The other issue was the controller bouncing down ramps. I posted about it two years ago and I don't believe Leadwerks has a solution to it yet. Even seeing the 3D Steam demo with the ramps, walk down the middle ramp backwards and you'll see that you're bouncing down the ramp instead of smoothly walking down. I get that the physics may be "right" but it looks and feels wrong. 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.