ShiVa Developer Forum • View topic - example CamRig_3rdPerson

example CamRig_3rdPerson

All about the StoneScript

example CamRig_3rdPerson

Postby unistudios » 2017-01-23 03:53

I am using the CamRig_3rdPerson example from the store, looks like when the player jumps an you move the player it falls to slow, the gravity is to low I used scene.setDynamicsGravity but results are not satisfied, any idea how to fix this?
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 2016-07-01 07:57

Re: example CamRig_3rdPerson

Postby .eb » 2017-01-23 18:19

It's really not about "fixing" it, but rather programming it to your liking.
- revert your change to scene.setDynamicsGravity. AKA set back to default.
- then go in editor, load the player-object into edit view, find and select the 'piece' that has the dynamics volume and then simply make changes to the dynamic-volume's settings, as you deem fit, via the Attributes panel.
-- That's a start anyhow.
Look at the MakingOfTheHunt.pdf file that is in installs of 192 and available in this site..just can't remember where sorry
Platinum Boarder
Platinum Boarder
Posts: 378
Joined: 2010-11-10 16:47
Location: Syracuse NY

Re: example CamRig_3rdPerson

Postby broozar » 2017-01-23 19:14

it's quite funny actually what people expect from jumping physics. i don't know if you realize that, but in old-school games like mario, the player gravity actually changes when you are in the air, so you fall much faster than what would be "realistic". over the years, people have become to expect this behaviour in their games, and when true phyics engines became the standard in games, the realistic acceleration suddenly looked all wrong. there's a nice video on the subject:

to simulate this effect, I would not change the scene gravity. instead, add an additional force (dynamics.addForce with 0,-9,0) to the player character when he is in the air (raycast down) and not moving upwards anymore (vertical velocity < 0.1). as soon as he hits the ground again (raycast down), remove that additional force again.

ps. the hunt - making of PDF is located at
User avatar
Posts: 4126
Joined: 2007-09-16 10:22
Location: Berlin - Germany

Re: example CamRig_3rdPerson

Postby Fraser » 2017-01-29 17:03

Yes tweak it to reverse engineer the physics you're after, it's possible to get any feel you want with ShiVa. People bash on ODE physics but I think it's as good as any provided you know how to drive it.

For player controlled platform character I now push a dynamic sphere around the level by adding globalspace forces and impulses and have the visible model be a seperate object that tracks it as if on a stiff elastic string using translateTo with nFactor like 10*lastFrameTime.

I use dynamics.setLinearDampingEx ( hDynamicSphere, 50, 0.5, 50 ) to make the vertical movement very free, and then control apparent gravity on the sphere by applying Y force as @broozar alluded to. And when jumping if player holds down the jump button you mantain some up force, this gives good control depth.

Take a few days learning the physics, it'll be worth it in the long run.
User avatar
Platinum Boarder
Platinum Boarder
Posts: 1324
Joined: 2012-02-05 19:28
Location: Europe

Return to Game programming

Who is online

Users browsing this forum: No registered users and 5 guests