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 / Tier 1 -- How do I set the sun position exactly like I want it?

Author
Message
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 18th May 2019 22:05
The game Race the Sun have you flying directly towards the sun, so the long cast shadows warn you of areas to avoid:
Youtube trailer

I really like this idea, and would very much like to steal it! So I need this command:
SetSunDirection(-0.121, -0.104, -0.987)

And I need to set its values to ... something ... which places the sun just above the northern horizon. That is, right in front of the player, if he's facing in the Z direction.

But how do I figure out these weird values?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th May 2019 23:34
it is a vector. so set your sun position (p1) and then get the position you want the sun to look at (p2)
Then
SetSunDirection(p2.x - p1.x, p2.y - p1.y, p2.z - p1.z)
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 19th May 2019 00:43
Oh, yeah, vectors. Those bloody vectors. I should know this by now. But it was way easy, it just ... worked. Thanks!

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-22 21:52:40
Your offset time is: 2024-11-22 21:52:40