1 registered members (TipmyPip),
18,633
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
bounce?
#289595
09/14/09 10:56
09/14/09 10:56
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
Hi, I've got a problem with the bounce function.. this is just like a bouncing ball with z-going up/down and y-sidetoside.. Therefore I used
void ball_move()
{
c_move(me, vector(0, 0, move_speed*time_step), nullvector, IGNORE_PASSABLE | GLIDE);
if (trace_hit) { vec_to_angle(my.pan, bounce); }
}
The above function is in a while loop, the ball will move going up but when it hits entities it got stuck and no bouncing happens.. Why? I know that there should be something wrong with the Euler's angle.. I've already tried to add these codes if the ball hits the entities but still no luck.
vec_to_angle(my.pan, bounce);
my.pan = 0;
my.tilt = 0;
my.roll += 5 - random(10);
my.x = 0;
x - should be zero... Please advise
Can't is not an option™
|
|
|
Re: bounce?
[Re: seecah]
#289605
09/14/09 12:36
09/14/09 12:36
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
Change to:
c_move(me, vector(move_speed*time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);
...since local x is the direction the entity is pointing. Your code instead makes the entity point along the bounce vector, even though it wasn't pointing along its original vector in the first place. Then it moves "up" relative to the direction it's looking now, instead of just moving in the actual direction it's looking. I hope that's what you're looking for. Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: bounce?
[Re: JibbSmart]
#289621
09/14/09 14:18
09/14/09 14:18
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
I've tried but it'll go away from the camera of course since it keeps on adding it's x value.. It should not be that way..
Can't is not an option™
|
|
|
Re: bounce?
[Re: seecah]
#289640
09/14/09 15:33
09/14/09 15:33
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
Make it face up instead of facing the same direction as the camera.
By using the first vector in c_move, all motions are relative to the object's orientation.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
|