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 Physics & Dark A.I. & Dark Dynamix / Really simple question (Move CC)

Author
Message
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 22nd Aug 2010 07:55 Edited at: 24th Aug 2010 06:09
EDIT: Read below if you want to help

Could a mod please change the title to "Dynamic Forces Problem"?

I want coke, not Pepsi!
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 23rd Aug 2010 18:48
bUmP

I want coke, not Pepsi!
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 24th Aug 2010 06:10
I tried using a dynamic mesh then adding forces to it, for movement, jumping, etc, but the forces don't work! Infact my cube doesn't do ANYTHING when it starts, it's supposed to fall.
Here is my code (anyone can test if you have Dark physics and DBpro)


I want coke, not Pepsi!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 24th Aug 2010 07:13
I am not a maiven of DarkPhysics, but I know that if you change

to


it will at least work. I would also suggest that you move the camera back on the Z axis 100 screen units so you can see what is going on.

So many games to code.......so little time.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 24th Aug 2010 08:32
this works:


But it seems VERY laggy and stiff.
Also my movment doesn't work, but the falling at the start does.

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Aug 2010 10:30 Edited at: 24th Aug 2010 10:51
try reading the doc and running the demos before adding a new command it will make building your code easier plus you will know how you got there and the why it works.



what you missed
mode

the method of force to apply from a selection of –
1, force, has unit of mass * distance / time ^ 2
2, impulse, has unit of mass * distance / time
3, velocity change, has unit of distance / time, effect is mass independent
4, smooth impulse, same as impulse but effect is applied over all substeps of physics update
5, acceleration, has unit of distance / time ^ 2, an acceleration, treated like a force except the mass is not divided out before integration

Dark Physics makes any hot drink go cold.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 24th Aug 2010 18:30
Quote: "
1, force, has unit of mass * distance / time ^ 2
2, impulse, has unit of mass * distance / time
3, velocity change, has unit of distance / time, effect is mass independent
4, smooth impulse, same as impulse but effect is applied over all substeps of physics update
5, acceleration, has unit of distance / time ^ 2, an acceleration, treated like a force except the mass is not divided out before integration"



There is NO easier way of doing that?

If not how do I figure out what time is?

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Aug 2010 18:53
that what does, its in the help file, just use 2 and you'll see it working.



the above tells you what its doing for those that would like to know.

Dark Physics makes any hot drink go cold.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 24th Aug 2010 20:57 Edited at: 24th Aug 2010 21:15
Quote: "phy add rigid body force 1,0,0,5,2"


1,0,0,5,2

1 is force
0 is impulse
0 is velocity
5 is smooth impulse
2 is acceleration right?

How do I figure out what time, mass, and distance is in:
Quote: "1, force, has unit of mass * distance / time ^ 2
2, impulse, has unit of mass * distance / time
3, velocity change, has unit of distance / time, effect is mass independent
4, smooth impulse, same as impulse but effect is applied over all substeps of physics update
5, acceleration, has unit of distance / time ^ 2, an acceleration, treated like a force except the mass is not divided out before integration""

?

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Aug 2010 22:18 Edited at: 24th Aug 2010 22:20
Quote: "phy add rigid body force 1,0,0,5,2"


1 is id of object
0 force in x direction
0 force in y direction
5 force in z direction
2 impulse, has unit of mass * distance / time <<<<<< this bit is done for you by the physx wrapper.

read the doc on phy add rigid body force and how to use.

Dark Physics makes any hot drink go cold.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 24th Aug 2010 22:36 Edited at: 25th Aug 2010 05:55
EDIT 3: solved all of it so far


EDIT4: For future refference I tried adding jumping, can you explain why this doesn't work?

Also how would I go about a first person (i know how to do that) but when I press left and right it turns to sphere and the camera, and then when I press forward it goes that way (using forces or something with a dynamic object)

I want coke, not Pepsi!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 25th Aug 2010 16:20 Edited at: 25th Aug 2010 18:12
Quote: "For future refference I tried adding jumping, can you explain why this doesn't work?"


There are a couple of reasons. First, you never set jump# equal to 1 in the code, so the line

never gets executed.

Secondly, the force you apply is negative (i.e. downward) instead of positive when the spacekey is pressed. The command should be



You can see the movement as you have done it, but it is easier to see if you move the camera back on the Z axis.

EDIT:
I placed the camera where the sphere (object 1) is and got it moving around using the arrowkeys. Check it out:



So many games to code.......so little time.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 25th Aug 2010 20:49 Edited at: 26th Aug 2010 08:23
I have an idea for changing levels, i'm very tired though so can someone tell me if this idea will work? object 1 is player, 2 is map, and 3 is winzone.


I wrote it from the top of my head, it would be amazing if someone could tell me if it works, of course if it does I will be making functions for everything but this is just the main idea.

I want coke, not Pepsi!
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 26th Aug 2010 00:58 Edited at: 26th Aug 2010 20:52
Bumpss

I want coke, not Pepsi!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Aug 2010 15:15
To clear something up.....
Quote: "First, you never set jump# equal to 1 in the code, so the line
if spacekey()=1 and jump#=1

never gets executed."


Even though you set jump# = 1 at this line:


it requires that jumping# = 1 to do so. That line should not even compile, as it is not the proper syntax in the first place. Since jumping# never equals 1, jump# is never set to 1 in your code. That was the point I was making.

IMO, your code for determining levels is not the best way to do that and is akin to spaghetti code. Why not use a subroutine or a function to go to another level? You repeat almost identical code several times. Using the outdated GOTO command is ill-advised.

So many games to code.......so little time.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 29th Aug 2010 00:32
LBFN, I solved all that now pretty much, I just need help with this


I want coke, not Pepsi!

Login to post a reply

Server time is: 2024-04-26 14:28:42
Your offset time is: 2024-04-26 14:28:42