1 registered members (AndrewAMD),
684
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Mario Galaxy!
#339145
08/24/10 21:03
08/24/10 21:03
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
Hi, I was reading this article on Gamasutra about Mario Galaxy's gravity, in theory it sounds and looks pretty easy, take a look at the first page of the link. I was trying to do the same with AUM 52 workshop that talks about c_trace, I have an idea of what I have to do, but I don't know how to implement it. What I think I need to do is set the temp vector according the position of the normal that the c_trace is intercepting, also I think player.tilt should change its value according to the normal, but how do I tell the player and the trace where to turn? is this possible in Gamestudio? thanks for reading, I'll be waiting for an answer, this looks really interesting.
|
|
|
Re: Mario Galaxy!
[Re: Theil]
#339161
08/24/10 22:57
08/24/10 22:57
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
take a look at this from Helghast or this from Superku
|
|
|
Re: Mario Galaxy!
[Re: MrGuest]
#339166
08/24/10 23:54
08/24/10 23:54
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
That worked just great on the player, the only problem is that since the position of temp is not changing according to the position of the normal, the player is still falling down when it reaches the end of the planetoid, I need to change the c_trace(my.x,vector(my.x,my.y,my.z-150); for something else I think. The result I'm getting:
Last edited by Theil; 08/25/10 02:55.
|
|
|
Re: Mario Galaxy!
[Re: Theil]
#339267
08/25/10 17:44
08/25/10 17:44
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
i gues somthing like this
vec_set(temp,vector(0,0,-150); vec_rotate(temp,my.pan); vec_add(temp,my.x); c_trace(my.x,temp,IGNORE_ME);
didnt test it
"empty"
|
|
|
Re: Mario Galaxy!
[Re: flits]
#339294
08/25/10 19:22
08/25/10 19:22
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
This is the actual code, it almost work, I can go almost near to the bottom of the sphere, but I'm still falling.
my.pan += 8 * (key_a - key_d) * time_step; // rotate the player using the "A" and "D" keys // vec_set (temp, my.x); // copy player's position to temp vec_set(temp,vector(0,0,-5000)); vec_rotate(temp,my.pan); vec_add(temp,my.x); if(c_trace(my.x,temp,IGNORE_ME | IGNORE_PASSABLE)) { vec_rotate(normal,vector(-my.pan,0,0)); my.tilt = -asin(normal.x); my.roll = -asin(normal.y); } else { my.tilt += -my.tilt/5*time_step; my.roll += -my.roll/5*time_step; } distance_to_ground = c_trace (my.x, temp.x, IGNORE_ME | USE_BOX); movement_speed.x = 15 * (key_w - key_s) * time_step; // move the player using "W" and "S" movement_speed.y = 0; movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value movement_speed.z = maxv(-35 * time_step, movement_speed.z); // 35 = falling speed c_move (my, movement_speed.x, nullvector, GLIDE); // move the player
Last edited by Theil; 08/25/10 21:54.
|
|
|
Re: Mario Galaxy!
[Re: Pappenheimer]
#340221
09/01/10 22:52
09/01/10 22:52
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
Try out the other example. When I originally wrote it (for Pappenheimer, incidentally ) the testing scenario was fairly Mario Galaxy -like. Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Mario Galaxy!
[Re: MrGuest]
#340239
09/02/10 07:31
09/02/10 07:31
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
take a look at this from Helghast or this from Superku Just to put credit where it's due; JulzMighty did that code in this thread. I only borrowed that (but did put credit in there). Dont want people to think I did it, just making sure (Great piece of code btw, and does exactly what you want/need) regards,
|
|
|
Re: Mario Galaxy!
[Re: Helghast]
#340307
09/03/10 01:15
09/03/10 01:15
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
Thanks Helghast I saw the credit in your code snippet, and appreciate you keeping track of that Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
|