Gravity or small feet?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Keanu

Gravity or small feet?

Post by Keanu »

Well my new problem is I made a small terrain wich is all flat and in one corner has a soft slope. When my player (attached to a collision response animator) reaches the junction point, collides!It doesn't walk forward but stops! Is that caused because I never update the Y coordinate of my player. If I grow up it a little when walking my player can walk on slopes or on stairs but it seems to be jumping. Next question: it's normal that also if the gravity is at min (not 0), very small, my player on a slope continues to fall down, gently, but always going down. There's a way to change this?[img]c:\juza.bmp[/img]
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

first of all, i havent done collision detection in Irrlicht yet, so what Im about to say is just general knowledge.


Generally for slopes and steps, there is used the following algorithm:
1) see if proposed path collides, if so:
2) project the players position up a 'step' and project forward from there
3) if that works, then move that way (you've just walked up a stair/slope)

For the sliding thing:
if you imagine a ball or a box on a slope, it would slide right? So what is the difference between a ball and a person? the person is going to adjust their limbs in a way so that they dont slide. You cant model that in your collision detection because you're simplifying the person with a bounding box or sphere-- so instead, you'll need special code. Generally, when a person is on the ground, a 'on ground' or 'walking' flag is set. This snaps the person to the ground, and you dont have to apply gravity to them, since you know they wont be able to fall thru the ground.
a screen cap is worth 0x100000 DWORDS
Keanu

Post by Keanu »

Thank you as always keless to answer my stupid-looking questions. But the important thing is: there's a smooth way to go up stairs or slopes without manually modifying the Y coord of my player? I tried everything but I could go up stairs only in the collision demo. It depeends on the bounding box?(I used the way described in the tutorial to get the radius of the elipsoyd)
Please help me
R00mpel
Posts: 41
Joined: Sun Nov 09, 2003 10:12 am
Location: Russia, Nizhny Novgorod

Post by R00mpel »

I had the same problem: my camera didn't go up slopes... But i solved it by using OpenGL mode. You can also try to look parallel to the ground - sometimes it helps...
The only thing to fear is running out of beer!
Keanu
Posts: 13
Joined: Sun Jan 04, 2004 11:10 am
Location: Italy
Contact:

Post by Keanu »

I tryed using OpenGL also if I don't know what does it change, but it doesn't work. The camera looks parallel to the ground, I tryed also make it look a bit upward but still it doesn't work. Maybe I think it's time to have a detailed explanation of how the collision response animator works in Irrlicht. Anybody can help :?:
P4 2.53MHz 256MB GeForce4Mx VC++6.0
luvcraft
Posts: 23
Joined: Sun Apr 25, 2004 1:00 am
Location: Albuquerque, NM

Post by luvcraft »

I think the problem with stairs is that you're not putting the "bounding elipsoid" around your camera or your player. Without that elipsoid, your camera is just a single point, so even the smallest stairstep is infinitely high in comparison. Look at the collision detection tutorial for an example of how to apply it to the camera, and for the player, look at the API for setEllipsoidRadius.
R00mpel
Posts: 41
Joined: Sun Nov 09, 2003 10:12 am
Location: Russia, Nizhny Novgorod

Post by R00mpel »

If someone still experiences this problem, it's possible source is too low sliding value (it is the last parameter of the createCollisionResponseAnimator(...) function) :roll:
The only thing to fear is running out of beer!
Post Reply