Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: bfg100 on April 06, 2012, 09:23:19 AM
-
I would like to get the actor shadow like in the Alpha Polaris for instance, where the shadow changes its position relative to the light source.
I have something like that:
var lightpos, lightposX, lightposY,lightposZ;
lightpos = Scene.GetLightPosition("Lamp");
lightposX = lightpos.X - this.PosX;
lightposY = lightpos.Y;
lightposZ = lightpos.Z - this.PosZ;
actor.SetLightPosition(lightposX, lightposY, lightposZ);
What else should I do? Maybe some loop?
Maybe someone could help me with this, please.
-
You're on the right track.
I would define that code as an event in the actor.script (call it "lightupdate", e.g.):
on "lightupdate"
{
//Your Code
}
Then you could trigger it like this in the game_loop.script:
if(actor.IsWalking()) actor.ApplyEvent("lightupdate");
-
@Django
Now it works perfectly! Thanks for help.