- Main Page
- Packages
- Classes
- Files

- File List
- File Members

# D:/guillaume/guillara/3D/DXGfx/DXGfxLib/ScriptHelpers.cs

Go to the documentation of this file.

    00001 using System;
    00002 using System.Collections.Generic;
    00003 using System.Text;
    00004 using Microsoft.DirectX;
    00005 using Microsoft.DirectX.Direct3D;
    00006
    00007 namespace DXGfxLib
    00008 {
    00015     public class ScriptHelpers
    00016     {
    00017         public static SceneObject GetSceneObjectFromName(string name)
    00018         {
    00019             return DXGfxManager.GetGlobalInstance().GetObj(name) as SceneObject;
    00020         }
    00021
    00022         public static void MoveToPosition(SceneNode nodeToMove, Vector3 destination, float speed, float elapsedTime)
    00023         {
    00024             Vector3 diff = Vector3.Subtract(destination, nodeToMove.Position);
    00025             diff.Normalize();
    00026
    00027             nodeToMove.Position += elapsedTime * speed * diff;
    00028         }
    00029
    00030         public static void MoveToNamedArea(SceneNode nodeToMove, string areaName, float speed, float elapsedTime)
    00031         {
    00032             MoveToPosition(nodeToMove, GetSceneObjectFromName(areaName).Position, speed, elapsedTime);
    00033         }
    00034     }
    00035 }