Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Sphere fall to slow

Author
Message
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 21st Mar 2008 21:14
Hi
I make a sphere and use Physics for c++ but the sphere falling very slow.How i can change the gravity?
Fusspawn
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 21st Mar 2008 23:22
What Physics library are you using ?

Stuck in the land of the confused! and loving it!
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 22nd Mar 2008 03:27
Assuming you are using DarkPhysics the default gravity is 9.8 M/ Second^2

This means that all object should fall 9.8 meters in a second. If your object is huge it will "appear" to fall slow. To verify check the Y value over time

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Rye
21
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 22nd Mar 2008 04:44
he might be using his own physics.

In which case, you need to make sure that the time step is correct.

Look at the equations of motion

v = u + at velocity = initial Velocity + acceleration X Time

this is probably the one you want. If so, the current velocity will become the initial velocity of the next loop.

So the only thing you need to know is the time that has passed since the last calculation. This can be done in several ways.

1) Either set the number of loops per second, and have a constant for Time.

2) Subtract the old time from the current time. giving the time difference between loops. Store this in some fasion so that it can be accessed wherever it is needed.

3) some other.

Personnally i'd use a combination of 1 and 2. Set the Tick rate for your game, so a tick rate of 40 means 40 game loops per second. And then STILL calculate the time taken, and then only use the calculated version if it is bigger than the time for 1 tick.

This way, if for some reason a loop takes a bit longer, loading an object etc.. then it is still accounted for. You would still need
some varying delay so that the tick rate is constant. and you dont get more that 40 per second. Also, have the tick rate variable. So Faster computers can have faster ticks, producing more accurate calculations.

Probably gone a little off topic here, oh well. it might help some1.
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 22nd Mar 2008 17:39 Edited at: 22nd Mar 2008 17:40
I use Dark Physics for Darkgdk .net

No funktion to Control the gravity?

In the sample Vehicle the boxes falling faster.
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 22nd Mar 2008 18:10
How fast is your object falling? Make its diameter 10 and it should travel through its own diameter every second

You need to time it or post some code so that some can help you time the program.

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 22nd Mar 2008 19:18 Edited at: 22nd Mar 2008 19:19
I dont see the time.

I make a objectsphere then i use the kinematic.

No time i have set.
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 22nd Mar 2008 22:28
kinomatics are for objects you control directly use dynamic

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 23rd Mar 2008 17:32
Here my code from the Sphere:

Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 23rd Mar 2008 21:08
Here is a link to an example I coded some time ago. It is in DBPro but the translation to GDK should be easy
http://forum.thegamecreators.com/?m=forum_view&t=85923&b=30

It has a timer example that should explain what you need

All the best

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 24th Mar 2008 13:56
Cool thx. but startTime is define as??
String?

startTime = Timer()
` and here's our main loop
onetime = 0
do
phy update
sync
Hit = phy get collision data ( )
if (phy get collision object a ( )) > 0 and onetime = 0

onetime = 1
Droptime = Timer()-startTime
Text 10,10, Str$(Droptime)
endif
Text 10,10, Str$(Droptime)
loop
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 24th Mar 2008 13:56 Edited at: 24th Mar 2008 13:57
Cool thx. but startTime is define as??
String?

sry for double post
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Mar 2008 16:32
theplake
16
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 24th Mar 2008 18:36
I have found it.

dbSetGravity is that what i need ^^
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Mar 2008 18:41
Ahhh... I like that command too.

You know what is fun? Setting it to ZERO and you get a cheap and easy outer space kinda thing going!

Login to post a reply

Server time is: 2024-11-20 05:44:05
Your offset time is: 2024-11-20 05:44:05