Tuesday 5 October 2010

Target 3 Done!!


I have found a solution to create a flash light with vertical rotation for my project. First add a light to the level by right clicking in the perspective view on the floor near the PlayerStart; form the menu select Add Actor; then Add Light (Point). With the light still selected right click and from the menu select Convert Light; then SpotLights; then SpotlightMovable.
Now rotate SpotLightMovable to face the same way as the PlayerStart and raise it to the correct height; while still selected right click on the Spotlight Movable to bring up the Spotlight Movable’s Properties window. Expand Light Component and expand SpotLightComponent and change the outer cone angle properties to replicate a flashlight.
Now fire up kismet with the SpotLightMovable still selected; right click in the grey area; from the menu select New Event; then Level Loaded and that node appears.
Again right click in the grey area; from the menu select New Action; then Actor; then Get Location and Rotation and that node appears.
Again right click in the grey area; from the menu select New Action; then Actor; then Set Actor Location and that node appears.
Connect the Beginning of level of Level Loaded node to the In of Get Location and Rotation node.
Connect the Out of Get Location and Rotation node to the In of Set Actor Location node.
Connect the Out of Set Actor Location node to the In of Get Location and Rotation node.
Now right click on the Target of Set Actor Location node and from the menu select New Object Var Using SpotLightMovable_0.
Again right click in the grey area; from the menu select New Variable; then Player; then Player and that node appears. With the node still selected in the properties window under SeqVar_Player uncheck All Players.
Connect the Target of Get Location and Rotation node to the Player variable node.
Connect the Location of Set Actor Location node to the Player variable node.
Now right click on the Rotation Vector of the Get Location and Rotation node and from the menu select Create New Vector Variable. With the node still selected in the properties window under SeqVar_Vetor; then Vect Value change X to 0.001.
Connect the Rotation of Set Actor Location node to the Vector Variable node.
Finally right click on the Out of Set Actor Location node and from the menu select Set Active Delay; a dialog box that appears; type 0.001 and click Ok.

“A loop has been created which determines how frequently (0.001) the location and rotation of the player is updated which allows a smooth sync between flashlight and player”.
Excellent we have a flashlight that follows the player and also looks up and down.