Forum

> > CS2D > Scripts > Rotation based on player rotation with offset.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Rotation based on player rotation with offset.

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Rotation based on player rotation with offset.

Mami Tomoe
User Off Offline

Zitieren
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?
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht