Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / some trouble with math... i want to draw a ray (line) from a point

Author
Message
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 25th Apr 2013 06:07
what i'm trying to figure is this sort of function:

function drawRay(initial_X, initial_Y, angle, rayLength)

rayX = ?
rayY = ?
drawLine(initial_X, initial_Y, rayX, rayY, r, g, b)

endfunction

thanks for any help
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Apr 2013 06:38 Edited at: 25th Apr 2013 06:38
You're on the right track, sort of. It's simpler than you think.



If it happens to draw in the opposite direction, just swap sin and cos.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 25th Apr 2013 07:16 Edited at: 25th Apr 2013 07:18
i see

something is still wrong in my function :/

Attachments

Login to view attachments
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Apr 2013 08:29
What is rotatePoint suppose to do? You don't need it.

"You're all wrong. You're all idiots." ~Fluffy Rabbit

Login to post a reply

Server time is: 2024-11-24 12:03:08
Your offset time is: 2024-11-24 12:03:08