Jump to content

2D Physics


Felix Bytow
 Share

Recommended Posts

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 :-)

Link to comment
Share on other sites

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.

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...