MOVETYPE_BOUNCE without touching anything
How do I simulate MOVETYPE_BOUCE if an entity reaches a set origin (for example 500 < x < 900 and 100 < y < 1500)? I want the entity to 'bounce' and go back in reverse direction. I tried executing Ham_Touch but it didn't do anything.
|
Re: MOVETYPE_BOUNCE without touching anything
Just reflect their velocity as if they bounced.
|
Re: MOVETYPE_BOUNCE without touching anything
Thanks, works
|
Re: MOVETYPE_BOUNCE without touching anything
One question: If I reverse the velocity with * -1.0, it goes backwards and doesn't reverse the angle. How would I do that? I was never good with this velocity stuff :oops:
|
Re: MOVETYPE_BOUNCE without touching anything
Quote:
|
Re: MOVETYPE_BOUNCE without touching anything
More like multiply it by two, but where and how?
|
Re: MOVETYPE_BOUNCE without touching anything
Is it always a certain plane it is reflecting from?
If you know the normal of the plane it is reflecting off of, you can do this: Code:
|
Re: MOVETYPE_BOUNCE without touching anything
I'm trying to make a sort of virtual wall that's passable by the players but impassable by the entity (soccerjam ball). If the entity touches the origin, it should get reflected.
The box is defined like this: if( !(1808.0 < Y < 2670.0 ) || !( -2717.0 < X < -1744.0 ) || Z > 100.0 ) // reflect the ball I tried something with the example you posted but I've been only half successful. It gets reflected only when it wants to and the vector length is somehow twisted (that should be speed if I'm correct) as the ball's speed usually increases when it touches the fake wall. Here's the code in the ball's think: Code:
I'm pretty sure I did a huge mistake somewhere. Please correct me if that's the case as I really don't have a clue on what I'm doing. Vector stuff was never friends with me -.- |
Re: MOVETYPE_BOUNCE without touching anything
Code:
That's not what I meant by a normal. The normal describes the direction a plane's flat side is facing. How do you want this to bounce? Backwards at where it came from, or as if it hit a wall at an angle? |
Re: MOVETYPE_BOUNCE without touching anything
Exactly as if it would hit a wall (with an angle). Also, do you have an idea on why the speed is getting increased on bounce? Sometimes it just bounces between two planes until it gets stuck and it looks super retarded.
|
| All times are GMT -4. The time now is 06:08. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.