Forum

> > CS2D > Scripts > Rotation based on player rotation with offset.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Rotation based on player rotation with offset.

2 replies
To the start Previous 1 Next To the start

old Rotation based on player rotation with offset.

Mami Tomoe
User Off Offline

Quote
Hey! I'm a little... so/so with math.
So I came here after attempting to solve this alone for like an hour.

I have a player (that can rotate of course), that player will cause an event (hook) that will cause projectiles to come out of his left and right "wing" (arms).

Example:

IMG:https://i.imgur.com/RNT197x.png


Left and right arrows being where the projectile will launch from (about 16 or 32 pixels from the player) and the circle being the player (with his gun as an arrow (where he's pointing)).

Currently with my random attempts of using random math functions I've made it this far:
1
2
3
4
local rot = player(p, 'rot')
					
parse('spawnprojectile ' .. p .. ' 48 ' .. player(p, 'x') - ( _math.tan(rot) * 62 ) .. ' ' .. player(p, 'y') .. ' 320 ' .. rot)
parse('spawnprojectile ' .. p .. ' 48 ' .. player(p, 'x') + ( _math.tan(rot) * 62 ) .. ' ' .. player(p, 'y') .. ' 320 ' .. rot)
(I use
_math.
, but you can use
math.
.)

Of course, that doesn't work otherwise I wouldn't post this
Or would I?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview