Shard Posted February 28, 2010 Share Posted February 28, 2010 Hey everyone. So I've written a(n okay) day-night cycle but I'm having a little trouble placing the corona for the sun to make it look realistic and I was wondering if someone code help my code out a little bit. The problem I'm having right now is making the corona show up and making it rotate along with the light. void World::CreateCycle(int time = 0) { time = (15*time) - 90; this->cycle = true; //Sunlight this->sunLight = CreateDirectionalLight(); PositionEntity(this->sunLight, Vec3(0,0,0)); RotateEntity(this->sunLight,Vec3(time,0,0)); sun = CreateCorona(); PaintEntity(sun, LoadMaterial("abstract::flare1.mat")); SetCoronaRadius(sun,10,30); PositionEntity(sun,Vec3(0,500,0)); ////Moonlight //this->moonLight = CreateDirectionalLight(); //PositionEntity(this->moonLight, Vec3(0,0,0)); //RotateEntity(this->moonLight,Vec3(time + 180,0,0)); //EntityColor(this->moonLight,Vec4(0)); } void World::UpdateCycle() { TurnEntity(this->sunLight,Vec3(.5,0,0),1); TVec3 sunPos = EntityPosition(sun); sunPos.X = 500*cos(.5); sunPos.Y = 500*sin(.5); PositionEntity(sun,sunPos); } Quote Programmer/Engineer/Student www.reikumar.com 2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM C++ - Visual Studio Express - Dark GDK - Leadwerks SDK Link to comment Share on other sites More sharing options...
Rick Posted March 1, 2010 Share Posted March 1, 2010 Try making your directional light the parent to your corona. It should just follow it then. Quote Link to comment Share on other sites More sharing options...
Shard Posted March 1, 2010 Author Share Posted March 1, 2010 Try making your directional light the parent to your corona. It should just follow it then. Well if you notice the directional light has been placed at 0,0,0 and is rotated at that spot. But the corona has to be up in the sky. I did try it in code but it didn't result with any changes. Quote Programmer/Engineer/Student www.reikumar.com 2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM C++ - Visual Studio Express - Dark GDK - Leadwerks SDK Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.