Jump to content
Site Stability Read more... ×
• Advertisement

Public Group

# Figuring out normal force.

This topic is 2093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hello everyone!

I have a question that pertains to figuring out normal force. I seem to have a predicament that involves collision detection.

At the start I first sum all the forces acting on the object at hand. All external forces come from input or collisions that were maybe applied last cycle. Then all the internal forces: friction, gravity, and normal force. Gravity I can figure out, but figure friction requires me to know the normal but for that I have to know if I'm standing on a platform or not. My question is, is there some elegant way to solve this? For example, is it plausible to just omit the normal force on the first cycle, check collisions and apply the normal force on the next? Or should I make a deliberate check if player is standing on a platform?

#### Share this post

##### Share on other sites
Advertisement

It looks like you are making a step into the Continuous Collision Detection concept.

The idea is simple. You should first detect the collision between the two bodies, platform and player. When this type of collision is made, you mark it them as colliding, thus activating your continuous contact routines, which should apply the normal force. While they are marked as colliding, you should apply the normal, and keep in watch for a break of this contact, that could be caused by several things:

The player jumps

The player goes beyond the platform border

A new force is applied (a bomb, a bullet, a backflip kick from a rhino...)

Any force change (weakening gravity, variable magnetic force)

This is a simplified version of the theory, also notice that it is my own interpretation, but it is quite a complex algorithm and I am searching the Box2D code to understand its implementation myself; so I can't help you further, but if you like to read code, here is a link that can.

You could use a simpler but specialized version. It would probably perform even better.

#### Share this post

##### Share on other sites

From your description, it sounds like the platform is not a collision object. If you make the platform a collision object, a collision will result (when appropriate) between the player and the platform, and provide the point of contact and the contact normal. (Many collision engines provide for a planar collision object with a normal, an extent, friction factors, etc.)

Am I understanding your question?

#### Share this post

##### Share on other sites

The normal force minus gravity equals 0 if you are standing on a platform.

N - G = 0
N = G


#### Share this post

##### Share on other sites

It looks like you are making a step into the Continuous Collision Detection concept.

The idea is simple. You should first detect the collision between the two bodies, platform and player. When this type of collision is made, you mark it them as colliding, thus activating your continuous contact routines, which should apply the normal force. While they are marked as colliding, you should apply the normal, and keep in watch for a break of this contact, that could be caused by several things:

The player jumps

The player goes beyond the platform border

A new force is applied (a bomb, a bullet, a backflip kick from a rhino...)

Any force change (weakening gravity, variable magnetic force)

This is a simplified version of the theory, also notice that it is my own interpretation, but it is quite a complex algorithm and I am searching the Box2D code to understand its implementation myself; so I can't help you further, but if you like to read code, here is a link that can.

You could use a simpler but specialized version. It would probably perform even better.

This seems to be pretty much what I was looking for. I wasn't sure what to look up but I'll have a look at this when I have time and get back to you on that.

From your description, it sounds like the platform is not a collision object. If you make the platform a collision object, a collision will result (when appropriate) between the player and the platform, and provide the point of contact and the contact normal. (Many collision engines provide for a planar collision object with a normal, an extent, friction factors, etc.)

Am I understanding your question?

The platform is a collision object. The entire world in my game is actually made out of discrete objects. My question should have been "how do I know if I'm standing on a platform if I haven't detected collisions yet on this cycle." My physics simulator does things in the following order: sum forces, get acceleration, integrate acceleration and velocity, and with the resulting disposition, check collisions and respond. The problem with this is that I won't know if I'm standing on a platform until I check collisions, but I need to know that when I'm summing forces because of the normal force.

The normal force minus gravity equals 0 if you are standing on a platform.

N - G = 0
N = G


The question isn't that simple I'm afraid. And I don't want to be a party pooper, but on an inclined surface, N != G.

#### Share this post

##### Share on other sites

The normal force minus gravity equals 0 if you are standing on a platform.

N - G = 0
N = G


It is not that simple, I suppose...

As boogyman pointed out, on any inclined surfaces, they'd have different values. The normal would also be in a different direction.

Important to notice, the normal isn't a reaction to gravity, but to everything that forces something against a surface. So, if you are on a rising platform, for example, it could have a normal that is higher than the sole effect of gravity.

As a side note, gravity is actually acceleration while normal is a force, I would try to avoid this kind of misleading comparison...

Edited by dejaime

#### Share this post

##### Share on other sites

N - G = 0
N = G


Oops, seems like I've been lazy with my terminology. I meant to say "force of gravity," or "weight" if you will.

EDIT: Seriously, I give up on quoting mechanism. I fail so hard at it XD

Edited by boogyman19946

#### Share this post

##### Share on other sites

On inclined surfaces the normal force will be equal with the sine or cosine of the inclined surface angle * gravity . Am I right?

Edited by Bratie Fanut

#### Share this post

##### Share on other sites

On inclined surfaces the normal force will be equal with the sine or cosine of the inclined surface angle * gravity . Am I right?

I always remember it as the negative projection of the gravity force onto the normal vector of the surface where the object is rested.

#### Share this post

##### Share on other sites

• Advertisement
• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• ### Popular Now

• 11
• 15
• 21
• 26
• 11
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!