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 / New to dark physics (Question)

Author
Message
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 19th Aug 2010 21:54 Edited at: 19th Aug 2010 23:29
I am the proud new owner of DGS bonanza !!
Anyway I got stuck with this code I was testing out, why doesn't it work? My sphere just stays in the air, no falling or anything or movement


You can test out the code yourself no media required

ooohh!! by the way does phy make rigid body dynamic mesh work???
It would be perfect collision! moveable perfect collision!

I want coke, not Pepsi!
Interplanetary Funk
14
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 20th Aug 2010 00:30
You're using character controllers in the completely wrong manner. When moving a CC you need to use the PHY MOVE CHARACTER CONTROLLER command. Also, you need to make your own gravity function for character controllers. Look at this snippet, I've completely rewritten the main loop and added a variable for the player speed, it should work 100%:

CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 20th Aug 2010 00:37
is there any way to move a dynamic object without CC?

I want coke, not Pepsi!
Interplanetary Funk
14
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 20th Aug 2010 00:41
not that I'm aware of, you could have a look at the velocity commands, but really, if it's a controllable object, CCs would be far more useful and easier than that, unless you're doing something where you want the player to be a ball rolling about, in which case as I said, look at the velocity functions.

(I haven't used them as I've never personally needed to, but I'm sure someone on here has and can help you)
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 20th Aug 2010 01:06
Just one more thing probally, I want my camera to turn as my guy turns not using X and C so my camera is always facing how the player is, how do you do that?

I want coke, not Pepsi!
Interplanetary Funk
14
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 20th Aug 2010 01:11
do you mean stay in a stationary position behind the player? Have a look at the SET CAMERA TO FOLLOW command.

BASIC programmers never die, they GOSUB and don't RETURN.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 20th Aug 2010 01:27
Quote: "do you mean stay in a stationary position behind the player? Have a look at the SET CAMERA TO FOLLOW command."


I know how to do that, I mean when the player rotates the camera rotates with it

I want coke, not Pepsi!
Interplanetary Funk
14
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 20th Aug 2010 01:40
something like:


BASIC programmers never die, they GOSUB and don't RETURN.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 20th Aug 2010 02:13
SOMETHING like that except only Y axis I think

I want coke, not Pepsi!
Interplanetary Funk
14
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 20th Aug 2010 02:38

maybe?

BASIC programmers never die, they GOSUB and don't RETURN.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 20th Aug 2010 02:41
yeah except I just realised i need the left and right keys to turn the object left and right, then when I press up it will go the way it's facing, how would I do that?

I want coke, not Pepsi!
Interplanetary Funk
14
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 20th Aug 2010 03:39
I'm not sure I get what you mean. And, not to be mean or anything, but it feels like I'm coding for you. Have a go at figuring things out yourself, read the manual, search the forums, look through the example code that comes with DBPro etc.
You'll find that learning that way is alot better and faster than asking everyone else to do it for you.

Also, I'm going to point you here.

Again, sorry if I came across as nasty, but trust me, it's better to learn for yourself than ask others to do stuff for you.

Good luck with your project and have fun coding!

BASIC programmers never die, they GOSUB and don't RETURN.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 20th Aug 2010 03:42 Edited at: 20th Aug 2010 04:13
Alright, thanks
EDIT: I re-wrote the code from scratch and got everything right except for here


this is the FULL code of that code


It's not staying rotated I think, can you please tell me what's wrong with it (I'm not asking for the code just what I did wrong)?


I also decided to try


Using dynamic instead of controller but it just goes through things and also it goes along y instead of z, I think i'm better off with the code above =P

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2010 12:37 Edited at: 20th Aug 2010 12:38
CocaCola,not a bad start can see you've been reading some of the threads.

Ok the clues where in the character controllers demo, where I found how to turn the object, so here below is the working code.



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: 20th Aug 2010 17:56 Edited at: 20th Aug 2010 18:19
so all I forgot was to wrapvalue(object angle y(1)-/+2)?
I added a nspeed too for negative, it makes going backwards easier, less math, and made a box instead of a cube.

In this I tried first person and making the mouse so you can look up and down, it worked until I tried to add the if cangley#>/<=
I also tried to make it so the camera will face how the cube is then the mouse moves the camera up and down but I failed MISERABLY at that so until I can get it right i set those to 0. Do you know whats wrong?

cangley stands for camera angle y by the way.

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2010 18:45
you might have to take the code form the demo and make it work with keys.

What you are seeing is the camera swing around to face the other way instead of following the object.

if this is the camera V
and this is FW------------BW
you see this when you move forward (< open end is seeing direction)
camera V >
FW----------------BW
but when you go backwards you get this
camera V <
BW-----------------FW

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: 20th Aug 2010 19:04 Edited at: 20th Aug 2010 19:06
Ok thanks for that, I made it so it turns with the camera, but i'm still having trouble with the mouse moving the camera up and down then if it gets above 180 stop there or lower than 45


Test that code out, it also lags alot when I get near a wall but that's ok. Do you know why the mouse-camera vertical isn't working

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2010 20:32
is this what you wanted it to do.



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: 20th Aug 2010 21:30 Edited at: 20th Aug 2010 21:57
Not exactly, I only want it to turn left and right when he's moving, so if he's going up a ramp it's NOT looking up.

I want the mouse to do the vertical movements so he can look up the ramp if he wants to, but not side to side he will have to turn to do that. Anyway why did you put 's in??



but thanks you got rid of the lag . After you help me with getting what I said above I can take it from there probably.



EDIT: like this, almost have it! But the screen just shakes. And I need it so you can look straight up but NOT past there so your looking behind, and you should be able to look a half way down from the default straight but no more! You shouldn't be able to fully move the camera towards the ground. Do you understand now?


I just can't figure that out!

By the way, collision doesn't seem to be working well, I tried adding move object down 1,1 for gravity but it goes through the floor, how do I relatively move it down while still having collision?

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2010 22:21
try this



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: 20th Aug 2010 22:34 Edited at: 20th Aug 2010 23:18
I edited a bit to get it to work but it does, now just 2 questions

1. How do I limit it so you cant look more than straight up and not fully down just like -45 degrees from the straight look
I tried this but it doesn't work

it just shows an error.

2. collision doesn't seem to be working well, I tried adding move object down 1,1 for gravity but it goes through the floor, how do I relatively move it down while still having collision?
EDIT: I have an idea for this, but how do you move character controller up and down like along the Y axis??

I need help with both, thanks

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2010 23:19
this get it going but needs some work on getting it to stay in the up down range.


LOOP

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: 20th Aug 2010 23:27
Nevermind #1 I have a different idea, can you help with #2?
Quote: "2. collision doesn't seem to be working well, I tried adding move object down 1,1 for gravity but it goes through the floor, how do I relatively move it down while still having collision?
EDIT: I have an idea for this, but how do you move character controller up and down like along the Y axis??"




I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 21st Aug 2010 00:00 Edited at: 21st Aug 2010 00:01
if you run this you will that it will move over the object andgo up un the air a bit as it goes over.



the only other thing you could try is setting the skin width.
phy set skin width value#

last post tonight I,m off to bed.

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: 21st Aug 2010 00:28 Edited at: 21st Aug 2010 02:11
Thanks but I was talking more about jumping, sorry forgot to say that, this is what I was testing, but it shows and error with friction#=phy get collision friction force y

I was attempting to if your on the ground then gravity=0 if not then gravity=0.5 which activates your falling. Theres 2 problems here that I noticed

1. The error above with friction#

2. When you do the phy move character controller if instantly puts you on the ground, you don't fall.

This is my attempt code



EDIT:
I also decided to try the camera thing again but it says camx# is not a variable or something, when I defined it as camera angle x(0)



I want coke, not Pepsi!
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 21st Aug 2010 19:55
Bump

I want coke, not Pepsi!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 21st Aug 2010 21:39
http://forum.thegamecreators.com/?m=forum_view&t=158090&b=30

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: 21st Aug 2010 23:58 Edited at: 22nd Aug 2010 07:53
Ok I will read that a bit later, just 2 things.

Whats wrong with this code, not the jumping/gravity the camera Y movement, I used your code and edited it, test this code and it shows an error with camx#=camera angle x(0)



EDIT: never mind the second the char controller up ill start a new thread just the other question

I want coke, not Pepsi!

Login to post a reply

Server time is: 2024-11-24 12:55:50
Your offset time is: 2024-11-24 12:55:50