Posted By: Theil
Mario Galaxy! - 08/24/10 21:03
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.
Posted By: Theil
Re: Mario Galaxy! - 08/24/10 23:54
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:
Posted By: flits
Re: Mario Galaxy! - 08/25/10 17:44
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
Posted By: Theil
Re: Mario Galaxy! - 08/25/10 19:22
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
Posted By: Theil
Re: Mario Galaxy! - 09/01/10 11:09
I give up, thanks anyway.
You could explain the problem more precisely and even upload a small testlevel where we can examine the problem, instead.
"I'm still falling" is not very helpful.
Posted By: JibbSmart
Re: Mario Galaxy! - 09/01/10 22:52
Try out the other example. When I originally wrote it (for Pappenheimer, incidentally
) the testing scenario was fairly Mario Galaxy -like.
Jibb
Posted By: Helghast
Re: Mario Galaxy! - 09/02/10 07:31
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,
Posted By: JibbSmart
Re: Mario Galaxy! - 09/03/10 01:15
Thanks Helghast
I saw the credit in your code snippet, and appreciate you keeping track of that
Jibb