Sprite math [advanced users]
Hi, i want to know how the heck i calculate to make a sprite floating and spinning around the player body in same time :) anyone can help me?
|
Re: Sprite math [advanced users]
I think i've already seen something like that, like a green line drawing a cylinder around a player, may be in WC3FT
|
Re: Sprite math [advanced users]
Quote:
|
Re: Sprite math [advanced users]
Code:
public NE_ULT_EntangleEffect( id, iSeconds ) |
Re: Sprite math [advanced users]
while ( iCounter <= 7 )
iCounter == 8 That's genius. |
Re: Sprite math [advanced users]
That code looks horrible.
This is how you do rotation: PHP Code:
|
Re: Sprite math [advanced users]
thanks guys :):3
|
Re: Sprite math [advanced users]
@Sylwester:
PHP Code:
EDIT: Does it have to do with this here? http://en.wikipedia.org/wiki/Rotation_matrix EDIT2: Oh, there is a formula for that. I'd like to see the prove. |
Re: Sprite math [advanced users]
What you are doing is rotating starting vector by 10 degrees, then rotating starting vector by 20 degrees and so on...
What my code does is rotate starting vector by 10 degrees, then rotate vector returned by previous operation by another 10 degrees and so on... The general formula for rotation is: new_x = x*cos(angle) - y*sin(angle) new_y = x*sin(angle) + y*cos(angle) and as you can see the formula you used is simply a special case of general formula: PHP Code:
2D transformations are usually done using 3x3 matrix, but since we need only rotation, then 2x2 was enough for that. |
| All times are GMT -4. The time now is 14:19. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.