Forum

> > CS2D > Scripts > Mathematic
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Mathematic

25 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Re: Mathematic

SQ
Moderator Off Offline

Zitieren
CS2D Lua and Official one is plain, simple and THE SAME.
And you were using cos function wrong.
You don't even know what COS, SIN, TG, CTG, ARCCOS, ARCSIN and all the freakin trigonometry works.

Just give a basic questions and we'll show how stuff works.

alt Re: Mathematic

xSkyLordx
User Off Offline

Zitieren
Okay

Hello guys,

how can i use math.cos and math.sin ??
i need 1 examples thanks

alt Re: Mathematic

EngiN33R
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
function fwdcalc(rot,x,y,factor)
	if rot<-90 then rot=rot+360 end
	local angle=math.rad(math.abs(rot+90))-math.pi
	local cx=x+(math.cos(angle)*factor)
	local cy=y+(math.sin(angle)*factor)
	return cx,cy
end

P.S. also, @user SQ:
1
2
DEG_TO_RAD = 0.0174532925199432957692369076848861
math.cos(ANGLE*DEG_TO_RAD)

Can easily be replaced with
1
math.cos(math.rad(ANGLE))
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht