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 / [DarkPHYSICS]: Character controller / Is there a way to jump, strafe, crouch...

Author
Message
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 21st Aug 2006 17:12
In the FPS sample given with DarkPHYSICS, we see the use of CHARACTER CONTROLLER command set but, there seem to not exist (in reference manual) commands to allow CONTROLED CHARACTER to jump, strafe, crouch ...
Is there a way to do that using CHARACTER CONTROLLER ...

All we have to decide is what to do with the time that is given to us.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 21st Aug 2006 18:13 Edited at: 21st Aug 2006 18:17
Some commands for this have been add4ed to the update for Dark Physics.

This command can be used for crouching
phy set character controller extents ID, radius#, height#
So to crouch just adjust the height of the controller then to stand restore the height back to normal.

This command could be used for jumping.
phy set character controller displacement ID, forward#, backward#

This is the explanation of this command in the docs from the update:

Quote: "can now control the displacement direction when the character controller is moving, this is used to manually implement forces such as gravity or moving from side to side, use the command phy set character controller displacement ID, forward#, backward# to override the default behaviour, when the movement speed is less than 0.0 then the backward# value is applied to the Y axis, when the movement speed is greater than 0.0 then the forward# value is applied to the Y axis"


So this command can be used to add gravity to the controller or add jumping directional movement to the controller.

so, to apply gravity you could do:


So this could also be used to apply a positive Y movement instead of -Gravity#, you could do Gravity# (positive)


But obviously this command does not apply a force to the character controller so you would to manually calculate how much and direction the movement needs to apllied, so to jump you would start of with a relativly high positive value then slowly decrease this back to the negative gravity

Hope that helped, the full list of new commands comes with the update.

I know the voices aren't real, but they have good ideas!
imekon
18
Years of Service
User Offline
Joined: 3rd Jul 2006
Location:
Posted: 21st Aug 2006 18:17
I'm either being a bit dense but... how do you do strafing?

I've got the forward/backward working but strafe left/right?

"Reality Bites"
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 21st Aug 2006 18:22
@imekon

There is a couple of ways, you could use the

phy set character controller displacement ID, x#, y#, z#

command to manually set the displacement, using cosine and sine to calculate the direction to move, or... the easy option is to apply your forward and backward movement using the

phy move character controller CharID, Value#

then after this has been called rotate your character controller object by 90 degrees in the right direction i.e. to strafe left turn your char' controller 90 degrees left then use the above command and move in that direction. then rotate the char' controller back to its original angle.

I know the voices aren't real, but they have good ideas!
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 21st Aug 2006 18:39
thanks

All we have to decide is what to do with the time that is given to us.
imekon
18
Years of Service
User Offline
Joined: 3rd Jul 2006
Location:
Posted: 21st Aug 2006 19:23
@monotonic

Now why didn't I think of that?

"Reality Bites"
imekon
18
Years of Service
User Offline
Joined: 3rd Jul 2006
Location:
Posted: 22nd Aug 2006 09:07
Here's a sample of strafing and jumping (though I've not got that working quite right yet):



What's wrong with the jumping code is it actually moves straight up - hardly 'jumping'. Then, let go of the spacebar and it drifts back down to the ground - as soon as you move, you shoot back down to the ground. It's this behaviour I haven't quite figured out yet.

"Reality Bites"
Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 23rd Aug 2006 05:20 Edited at: 23rd Aug 2006 05:24
I think the character controller is over complicating things, especially with the new undocumented commands. Can you please add a character controller form of position object xyz? If its there I'm so confused I can't see it o.O
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 23rd Aug 2006 17:05
@Imekon : nice snippet It will be really useful for me

All we have to decide is what to do with the time that is given to us.
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 23rd Aug 2006 22:00
I tried to use phy move character controller CharID, Value# to create jumps but it didn't worked.

Here is the dev source code :
[Inspired from Imekon sample]


All we have to decide is what to do with the time that is given to us.
Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 23rd Aug 2006 23:27 Edited at: 23rd Aug 2006 23:28
If MouseClick() = 2
xrotate object 2, 0
- >
phy move character controller 2, 100.0

I think you have to add a displacement before that, I think its phy set character controller displacement ID,x,y,z. If you set x and z to zero and y to 1 it might do something . Phy set character controller displacement ID, forward#, backward# is supposed to do something aswell.

This is why I think the current character controller commands are rubbish, personally I don't want to mess about with that stuff, its supposed to make it EASY to control a character. A position object command for this would make it a whole lot easier and having move commands for actual directions. The displacement crap makes things a lot more complicated than it should be.

I mean the readme included with the latest update might aswell be written in a lost language, makes no sense to someone who hasn't got a physics a-level (even they would go blank as I have just discovered)
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 23rd Aug 2006 23:50 Edited at: 23rd Aug 2006 23:50
The current commands are easy to use once you have them figured out, admittedly the documentation at the minute leaves a little to desired but these are being updated with the next DP update.

I have put the code I'm using to control my character at the minute this is just revision one and by no means the finished code I will be using, also there is no jumping code yet, that still needs implementing, but still this may help somebody to see how a couple of the commands work.



I know the voices aren't real, but they have good ideas!
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 24th Aug 2006 00:01
I tried Displacement without success. it do nothing !!!

All we have to decide is what to do with the time that is given to us.
Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 24th Aug 2006 00:11
imo, No they are not easy to use, nor practical, they are a waste of coding lines. You're code is good though But still the use of it seems to be limited to an fps or 3rd person player character.

You can't use them for enemies with a set AI path cause you would have to create a lot of dummy objects or use some unnessesary math.

I just want the damn thing to follow an x and z coordinate without spinning around like crazy and without drifting off into the distance for no apparent reason.

Login to post a reply

Server time is: 2024-11-24 14:31:43
Your offset time is: 2024-11-24 14:31:43