/// <summary> /// /// </summary> /// <param name="sceneMgr"></param> private void SetupBody(SceneManager sceneMgr) { // create main model this.bodyNode = sceneMgr.RootSceneNode.CreateChildSceneNode(Vector3.UnitY * CharHeight); this.bodyEnt = sceneMgr.CreateEntity("SinbadBody", "Sinbad.mesh"); this.bodyNode.AttachObject(this.bodyEnt); // create swords and attach to sheath this.sword1 = sceneMgr.CreateEntity("SinbadSword1", "Sword.mesh"); this.sword2 = sceneMgr.CreateEntity("SinbadSword2", "Sword.mesh"); this.bodyEnt.AttachObjectToBone("Sheath.L", this.sword1); this.bodyEnt.AttachObjectToBone("Sheath.R", this.sword2); // create a couple of ribbon trails for the swords, just for fun var paras = new NamedParameterList(); paras["numberOfChains"] = "2"; paras["maxElements"] = "80"; this.swordTrail = (RibbonTrail)sceneMgr.CreateMovableObject("SinbadRibbon", "RibbonTrail", paras); this.swordTrail.MaterialName = "Examples/LightRibbonTrail"; this.swordTrail.TrailLength = 20; this.swordTrail.IsVisible = false; sceneMgr.RootSceneNode.AttachObject(this.swordTrail); for (int i = 0; i < 2; i++) { this.swordTrail.SetInitialColor(i, new ColorEx(1, 0.8f, 0)); this.swordTrail.SetColorChange(i, new ColorEx(0.75f, 0.25f, 0.25f, 0.25f)); this.swordTrail.SetWidthChange(i, 1); this.swordTrail.SetInitialWidth(i, 0.5f); } this.keyDirection = Vector3.Zero; this.verticalVelocity = 0; }
public RibbonTrail AddRibbonTrail(float width, int maxelemnt, float len, Vector3 pos, int stretchType, float maxFps) { VertexSegment segment = GetVertices(maxelemnt * 2, (maxelemnt - 1) * 6); RibbonTrail trail = new RibbonTrail(segment, width, maxelemnt, len, pos, stretchType, maxFps); return(trail); }
private void setupBody(SceneManager sceneMgr) { mBodyNode = sceneMgr.RootSceneNode.CreateChildSceneNode(Mogre.Vector3.UNIT_Y * CHAR_HEIGHT); mBodyEnt = sceneMgr.CreateEntity("SinbadBody", "Sinbad.mesh"); mBodyNode.AttachObject(mBodyEnt); // create swords and attach to sheath mSword1 = sceneMgr.CreateEntity("SinbadSword1", "Sword.mesh"); mSword2 = sceneMgr.CreateEntity("SinbadSword2", "Sword.mesh"); mBodyEnt.AttachObjectToBone("Sheath.L", mSword1); mBodyEnt.AttachObjectToBone("Sheath.R", mSword2); // create a couple of ribbon trails for the swords, just for fun NameValuePairList paramslist = new NameValuePairList(); paramslist["numberOfChains"] = "2"; paramslist["maxElements"] = "80"; mSwordTrail = (RibbonTrail)sceneMgr.CreateMovableObject("RibbonTrail", paramslist); //mSwordTrail.MaterialName=("Examples/LightRibbonTrail"); mSwordTrail.TrailLength = 20; mSwordTrail.Visible = (false); sceneMgr.RootSceneNode.AttachObject(mSwordTrail); for (uint i = 0; i < 2; i++) { mSwordTrail.SetInitialColour(i, 1f, 0.8f, 0f); mSwordTrail.SetColourChange(i, 0.75f, 1.25f, 1.25f, 1.25f); mSwordTrail.SetWidthChange(i, 1); mSwordTrail.SetInitialWidth(i, 0.5f); } mKeyDirection = Mogre.Vector3.ZERO; mVerticalVelocity = 0; }
public DashJavelin(ThingBlock block, ThingDefinition def) : base(block, def) { ModelComponent chassis = ModelComponents[0]; // first get rid of the existing animation blender it creates automatically LKernel.GetG<AnimationManager>().Remove(chassis.AnimationBlender); chassis.AnimationBlender = null; Entity chassisEnt = chassis.Entity; // get our two animation states jetMax = chassisEnt.GetAnimationState("JetMax"); jetMax.Enabled = true; jetMax.Weight = 0f; jetMin = chassisEnt.GetAnimationState("JetMin"); jetMin.Enabled = true; jetMin.Weight = 1f; // we want the two animations to blend together, not add to each other chassisEnt.Skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_AVERAGE; jetRibbon = RibbonComponents[0].Ribbon; // sounds soundMain = LKernel.GetG<SoundMain>(); idleSound = SoundComponents[0].Sound; fullSound = SoundComponents[1].Sound; revDownSound = soundMain.GetSource("RD_Kart_Rev_Down.ogg"); revUpSound = soundMain.GetSource("RD_Kart_Rev_Up.ogg"); // convert from linear velocity to KPH topSpeedKmHour = DefaultMaxSpeed * 3.6f; idleState = true; LKernel.GetG<Root>().FrameStarted += FrameStarted; }
public virtual void RemoveRibbonTrail( RibbonTrail ribbonTrail ) { this.DestroyMovableObject( ribbonTrail ); }
/// <summary> /// /// </summary> /// <param name="sceneMgr"></param> private void SetupBody( SceneManager sceneMgr ) { // create main model bodyNode = sceneMgr.RootSceneNode.CreateChildSceneNode( Vector3.UnitY * CharHeight ); bodyEnt = sceneMgr.CreateEntity( "SinbadBody", "Sinbad.mesh" ); bodyNode.AttachObject( bodyEnt ); // create swords and attach to sheath sword1 = sceneMgr.CreateEntity( "SinbadSword1", "Sword.mesh" ); sword2 = sceneMgr.CreateEntity( "SinbadSword2", "Sword.mesh" ); bodyEnt.AttachObjectToBone( "Sheath.L", sword1 ); bodyEnt.AttachObjectToBone( "Sheath.R", sword2 ); // create a couple of ribbon trails for the swords, just for fun NamedParameterList paras = new NamedParameterList(); paras[ "numberOfChains" ] = "2"; paras[ "maxElements" ] = "80"; swordTrail = (RibbonTrail)sceneMgr.CreateMovableObject( "SinbadRibbon", "RibbonTrail", paras ); swordTrail.MaterialName = "Examples/LightRibbonTrail"; swordTrail.TrailLength = 20; swordTrail.IsVisible = false; sceneMgr.RootSceneNode.AttachObject( swordTrail ); for ( int i = 0; i < 2; i++ ) { swordTrail.SetInitialColor( i, new ColorEx( 1, 0.8f, 0 ) ); swordTrail.SetColorChange( i, new ColorEx( 0.75f, 0.25f, 0.25f, 0.25f ) ); swordTrail.SetWidthChange( i, 1 ); swordTrail.SetInitialWidth( i, 0.5f ); } keyDirection = Vector3.Zero; verticalVelocity = 0; }
public void SetType(float width, int maxelemnt, float len, Vector3 pos, int stretchType, float maxFps) { Type = 2; Ribbon = Owner.GetVertexPool().AddRibbonTrail(width, maxelemnt, len, pos, stretchType, maxFps); }
public RibbonTrail AddRibbonTrail(float width,int maxelemnt, float len,Vector3 pos,int stretchType,float maxFps) { VertexSegment segment = GetVertices(maxelemnt * 2, (maxelemnt - 1) * 6); RibbonTrail trail = new RibbonTrail(segment, width, maxelemnt, len, pos, stretchType, maxFps); return trail; }
//ribbon trail public void SetType(float width, int maxelemnt, float len,Vector3 pos,int stretchType,float maxFps) { Type = 2; Ribbon = Owner.GetVertexPool().AddRibbonTrail(width, maxelemnt, len, pos, stretchType, maxFps); }
protected void CreateRibbons() { viewport.BackgroundColor = ColorEx.Black; float scale = 100f; scene.AmbientLight = new ColorEx(0.5f, 0.5f, 0.5f); //scene.SetSkyBox(true, "Examples/SpaceSkyBox", 20f * oneMeter); Vector3 dir = new Vector3(-1f, -1f, 0.5f); dir.Normalize(); Light light1 = scene.CreateLight("light1"); light1.Type = LightType.Directional; light1.Direction = dir; // Create a barrel for the ribbons to fly through Entity barrel = scene.CreateEntity("barrel", "barrel.mesh"); SceneNode barrelNode = scene.RootSceneNode.CreateChildSceneNode(); barrelNode.ScaleFactor = 5f * Vector3.UnitScale; barrelNode.AttachObject(barrel); RibbonTrail trail = new RibbonTrail("DemoTrail", "numberOfChains", 2, "maxElementsPerChain", 80); trail.MaterialName = "Examples/LightRibbonTrail"; trail.TrailLength = scale * 400f; scene.RootSceneNode.CreateChildSceneNode().AttachObject(trail); // Create 3 nodes for trail to follow SceneNode animNode = scene.RootSceneNode.CreateChildSceneNode(); animNode.Position = scale * new Vector3(50f, 30f, 0); Animation anim = scene.CreateAnimation("an1", 14); anim.InterpolationMode = InterpolationMode.Spline; NodeAnimationTrack track = anim.CreateNodeTrack(1, animNode); TransformKeyFrame kf = track.CreateNodeKeyFrame(0); kf.Translate = scale * new Vector3(50f,30f,0f); kf = track.CreateNodeKeyFrame(2); kf.Translate = scale * new Vector3(100f, -30f, 0f); kf = track.CreateNodeKeyFrame(4); kf.Translate = scale * new Vector3(120f, -100f, 150f); kf = track.CreateNodeKeyFrame(6); kf.Translate = scale * new Vector3(30f, -100f, 50f); kf = track.CreateNodeKeyFrame(8); kf.Translate = scale * new Vector3(-50f, 30f, -50f); kf = track.CreateNodeKeyFrame(10); kf.Translate = scale * new Vector3(-150f, -20f, -100f); kf = track.CreateNodeKeyFrame(12); kf.Translate = scale * new Vector3(-50f, -30f, 0f); kf = track.CreateNodeKeyFrame(14); kf.Translate = scale * new Vector3(50f, 30f, 0f); AnimationState animState = scene.CreateAnimationState("an1"); //animState.Enabled = true; animStateList = new List<AnimationState>(); animStateList.Add(animState); trail.SetInitialColor(0, 1.0f, 0.8f, 0f, 1.0f); trail.SetColorChange(0, 0.5f, 0.5f, 0.5f, 0.5f); trail.SetInitialWidth(0, scale * 5f); trail.AddNode(animNode); // Add light Light light2 = scene.CreateLight("light2"); light2.Diffuse = trail.GetInitialColor(0); animNode.AttachObject(light2); // Add billboard BillboardSet bbs = scene.CreateBillboardSet("bb", 1); bbs.CreateBillboard(Vector3.Zero, trail.GetInitialColor(0)); bbs.MaterialName = "flare"; animNode.AttachObject(bbs); animNode = scene.RootSceneNode.CreateChildSceneNode(); animNode.Position = scale * new Vector3(-50f, 100f, 0f); anim = scene.CreateAnimation("an2", 10); anim.InterpolationMode = InterpolationMode.Spline; track = anim.CreateNodeTrack(1, animNode); kf = track.CreateNodeKeyFrame(0); kf.Translate = scale * new Vector3(-50f,100f,0f); kf = track.CreateNodeKeyFrame(2); kf.Translate = scale * new Vector3(-100f, 150f, -30f); kf = track.CreateNodeKeyFrame(4); kf.Translate = scale * new Vector3(-200f, 0f, 40f); kf = track.CreateNodeKeyFrame(6); kf.Translate = scale * new Vector3(0f, -150f, 70f); kf = track.CreateNodeKeyFrame(8); kf.Translate = scale * new Vector3(50f, 0f, 30f); kf = track.CreateNodeKeyFrame(10); kf.Translate = scale * new Vector3(-50f,100f,0f); animState = scene.CreateAnimationState("an2"); //animState.setEnabled(true); animStateList.Add(animState); trail.SetInitialColor(1, 0.0f, 1.0f, 0.4f, 1.0f); trail.SetColorChange(1, 0.5f, 0.5f, 0.5f, 0.5f); trail.SetInitialWidth(1, scale * 5f); trail.AddNode(animNode); // Add light Light light3 = scene.CreateLight("l3"); light3.Diffuse = trail.GetInitialColor(1); animNode.AttachObject(light3); // Add billboard bbs = scene.CreateBillboardSet("bb2", 1); bbs.CreateBillboard(Vector3.Zero, trail.GetInitialColor(1)); bbs.MaterialName = "flare"; animNode.AttachObject(bbs); }
void SetupTrailLights() { sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f); Vector3 dir = new Vector3(-1, -1, 0.5f); dir.Normalise(); Light l = sceneMgr.CreateLight("light1"); l.Type = Light.LightTypes.LT_DIRECTIONAL; l.Direction = dir; NameValuePairList pairList = new NameValuePairList(); pairList["numberOfChains"] = "2"; pairList["maxElements"] = "80"; RibbonTrail trail = (RibbonTrail)( sceneMgr.CreateMovableObject("1", "RibbonTrail", pairList)); trail.MaterialName = "Examples/LightRibbonTrail"; trail.TrailLength = 400; sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(trail); // Create 3 nodes for trail to follow SceneNode animNode = sceneMgr.RootSceneNode.CreateChildSceneNode(); animNode.Position = new Vector3(50, 30, 0); Animation anim = sceneMgr.CreateAnimation("an1", 14); anim.SetInterpolationMode(Animation.InterpolationMode.IM_SPLINE); NodeAnimationTrack track = anim.CreateNodeTrack(1, animNode); TransformKeyFrame kf = track.CreateNodeKeyFrame(0); kf.Translate = new Vector3(50, 30, 0); kf = track.CreateNodeKeyFrame(2); kf.Translate = new Vector3(100, -30, 0); kf = track.CreateNodeKeyFrame(4); kf.Translate = new Vector3(120, -100, 150); kf = track.CreateNodeKeyFrame(6); kf.Translate = new Vector3(30, -100, 50); kf = track.CreateNodeKeyFrame(8); kf.Translate = new Vector3(-50, 30, -50); kf = track.CreateNodeKeyFrame(10); kf.Translate = new Vector3(-150, -20, -100); kf = track.CreateNodeKeyFrame(12); kf.Translate = new Vector3(-50, -30, 0); kf = track.CreateNodeKeyFrame(14); kf.Translate = new Vector3(50, 30, 0); AnimationState animState = sceneMgr.CreateAnimationState("an1"); animState.Enabled = true; mAnimStateList.Add(animState); trail.SetInitialColour(0, 1.0f, 0.8f, 0); trail.SetColourChange(0, 0.5f, 0.5f, 0.5f, 0.5f); trail.SetInitialWidth(0, 5); trail.AddNode(animNode); // Add light Light l2 = sceneMgr.CreateLight("l2"); l2.DiffuseColour = (trail.GetInitialColour(0)); animNode.AttachObject(l2); // Add billboard BillboardSet bbs = sceneMgr.CreateBillboardSet("bb", 1); bbs.CreateBillboard(Vector3.ZERO, trail.GetInitialColour(0)); bbs.MaterialName = "Examples/Flare"; animNode.AttachObject(bbs); animNode = sceneMgr.RootSceneNode.CreateChildSceneNode(); animNode.Position = new Vector3(-50, 100, 0); anim = sceneMgr.CreateAnimation("an2", 10); anim.SetInterpolationMode(Animation.InterpolationMode.IM_SPLINE); track = anim.CreateNodeTrack(1, animNode); kf = track.CreateNodeKeyFrame(0); kf.Translate = new Vector3(-50, 100, 0); kf = track.CreateNodeKeyFrame(2); kf.Translate = new Vector3(-100, 150, -30); kf = track.CreateNodeKeyFrame(4); kf.Translate = new Vector3(-200, 0, 40); kf = track.CreateNodeKeyFrame(6); kf.Translate = new Vector3(0, -150, 70); kf = track.CreateNodeKeyFrame(8); kf.Translate = new Vector3(50, 0, 30); kf = track.CreateNodeKeyFrame(10); kf.Translate = new Vector3(-50, 100, 0); animState = sceneMgr.CreateAnimationState("an2"); animState.Enabled = true; mAnimStateList.Add(animState); trail.SetInitialColour(1, 0.0f, 1.0f, 0.4f); trail.SetColourChange(1, 0.5f, 0.5f, 0.5f, 0.5f); trail.SetInitialWidth(1, 5); trail.AddNode(animNode); // Add light l2 = sceneMgr.CreateLight("l3"); l2.DiffuseColour = trail.GetInitialColour(1); animNode.AttachObject(l2); // Add billboard bbs = sceneMgr.CreateBillboardSet("bb2", 1); bbs.CreateBillboard(Vector3.ZERO, trail.GetInitialColour(1)); bbs.MaterialName = "Examples/Flare"; animNode.AttachObject(bbs); }
/// <summary> /// Removes the specified RibbonTrail from the scene. /// </summary> /// <remarks> /// This method removes a previously added RibbonTrail from the scene. /// </remarks> /// <param name="ribbonTrail">Reference to the RibbonTrail to remove.</param> public virtual void RemoveRibbonTrail(RibbonTrail ribbonTrail) { ExtractMovableObject(ribbonTrail); }
/// <summary> /// Creates a ribbon trail /// </summary> /// <param name="name"></param> /// <returns></returns> public virtual RibbonTrail CreateRibbonTrail(string name) { RibbonTrail ribbonTrail = new RibbonTrail(name); // add it to our local list GetMovableObjectMap("RibbonTrail")[name] = ribbonTrail; return ribbonTrail; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RibbonTrail obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
protected void CreateRibbons() { viewport.BackgroundColor = ColorEx.Black; float scale = 100f; scene.AmbientLight = new ColorEx(0.5f, 0.5f, 0.5f); //scene.SetSkyBox(true, "Examples/SpaceSkyBox", 20f * oneMeter); Vector3 dir = new Vector3(-1f, -1f, 0.5f); dir.Normalize(); Light light1 = scene.CreateLight("light1"); light1.Type = LightType.Directional; light1.Direction = dir; // Create a barrel for the ribbons to fly through Entity barrel = scene.CreateEntity("barrel", "barrel.mesh"); SceneNode barrelNode = scene.RootSceneNode.CreateChildSceneNode(); barrelNode.ScaleFactor = 5f * Vector3.UnitScale; barrelNode.AttachObject(barrel); RibbonTrail trail = new RibbonTrail("DemoTrail", "numberOfChains", 2, "maxElementsPerChain", 80); trail.MaterialName = "Examples/LightRibbonTrail"; trail.TrailLength = scale * 400f; scene.RootSceneNode.CreateChildSceneNode().AttachObject(trail); // Create 3 nodes for trail to follow SceneNode animNode = scene.RootSceneNode.CreateChildSceneNode(); animNode.Position = scale * new Vector3(50f, 30f, 0); Animation anim = scene.CreateAnimation("an1", 14); anim.InterpolationMode = InterpolationMode.Spline; NodeAnimationTrack track = anim.CreateNodeTrack(1, animNode); TransformKeyFrame kf = track.CreateNodeKeyFrame(0); kf.Translate = scale * new Vector3(50f, 30f, 0f); kf = track.CreateNodeKeyFrame(2); kf.Translate = scale * new Vector3(100f, -30f, 0f); kf = track.CreateNodeKeyFrame(4); kf.Translate = scale * new Vector3(120f, -100f, 150f); kf = track.CreateNodeKeyFrame(6); kf.Translate = scale * new Vector3(30f, -100f, 50f); kf = track.CreateNodeKeyFrame(8); kf.Translate = scale * new Vector3(-50f, 30f, -50f); kf = track.CreateNodeKeyFrame(10); kf.Translate = scale * new Vector3(-150f, -20f, -100f); kf = track.CreateNodeKeyFrame(12); kf.Translate = scale * new Vector3(-50f, -30f, 0f); kf = track.CreateNodeKeyFrame(14); kf.Translate = scale * new Vector3(50f, 30f, 0f); AnimationState animState = scene.CreateAnimationState("an1"); //animState.Enabled = true; animStateList = new List <AnimationState>(); animStateList.Add(animState); trail.SetInitialColor(0, 1.0f, 0.8f, 0f, 1.0f); trail.SetColorChange(0, 0.5f, 0.5f, 0.5f, 0.5f); trail.SetInitialWidth(0, scale * 5f); trail.AddNode(animNode); // Add light Light light2 = scene.CreateLight("light2"); light2.Diffuse = trail.GetInitialColor(0); animNode.AttachObject(light2); // Add billboard BillboardSet bbs = scene.CreateBillboardSet("bb", 1); bbs.CreateBillboard(Vector3.Zero, trail.GetInitialColor(0)); bbs.MaterialName = "flare"; animNode.AttachObject(bbs); animNode = scene.RootSceneNode.CreateChildSceneNode(); animNode.Position = scale * new Vector3(-50f, 100f, 0f); anim = scene.CreateAnimation("an2", 10); anim.InterpolationMode = InterpolationMode.Spline; track = anim.CreateNodeTrack(1, animNode); kf = track.CreateNodeKeyFrame(0); kf.Translate = scale * new Vector3(-50f, 100f, 0f); kf = track.CreateNodeKeyFrame(2); kf.Translate = scale * new Vector3(-100f, 150f, -30f); kf = track.CreateNodeKeyFrame(4); kf.Translate = scale * new Vector3(-200f, 0f, 40f); kf = track.CreateNodeKeyFrame(6); kf.Translate = scale * new Vector3(0f, -150f, 70f); kf = track.CreateNodeKeyFrame(8); kf.Translate = scale * new Vector3(50f, 0f, 30f); kf = track.CreateNodeKeyFrame(10); kf.Translate = scale * new Vector3(-50f, 100f, 0f); animState = scene.CreateAnimationState("an2"); //animState.setEnabled(true); animStateList.Add(animState); trail.SetInitialColor(1, 0.0f, 1.0f, 0.4f, 1.0f); trail.SetColorChange(1, 0.5f, 0.5f, 0.5f, 0.5f); trail.SetInitialWidth(1, scale * 5f); trail.AddNode(animNode); // Add light Light light3 = scene.CreateLight("l3"); light3.Diffuse = trail.GetInitialColor(1); animNode.AttachObject(light3); // Add billboard bbs = scene.CreateBillboardSet("bb2", 1); bbs.CreateBillboard(Vector3.Zero, trail.GetInitialColor(1)); bbs.MaterialName = "flare"; animNode.AttachObject(bbs); }
private void CreateScene() { var cache = ResourceCache; scene = new Scene(Context); // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000) scene.CreateComponent <Octree>(); // Create scene node & StaticModel component for showing a static plane var planeNode = scene.CreateChild("Plane"); planeNode.Scale = new Vector3(100.0f, 1.0f, 100.0f); var planeObject = planeNode.CreateComponent <StaticModel>(); planeObject.Model = cache.GetModel("Models/Plane.mdl"); planeObject.SetMaterial(cache.GetMaterial("Materials/StoneTiled.xml")); // Create a directional light to the world. var lightNode = scene.CreateChild("DirectionalLight"); lightNode.SetDirection(new Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized var light = lightNode.CreateComponent <Light>(); light.LightType = LightType.Directional; light.CastShadows = true; light.ShadowBias = new BiasParameters(0.00005f, 0.5f); // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance light.ShadowCascade = new CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f); // Create first box for face camera trail demo with 1 column. boxNode1 = scene.CreateChild("Box1"); var box1 = boxNode1.CreateComponent <StaticModel>(); box1.Model = cache.GetModel("Models/Box.mdl"); box1.CastShadows = true; var boxTrail1 = boxNode1.CreateComponent <RibbonTrail>(); boxTrail1.Material = cache.GetMaterial("Materials/RibbonTrail.xml"); boxTrail1.StartColor = new Color(1.0f, 0.5f, 0.0f, 1.0f); boxTrail1.EndColor = new Color(1.0f, 1.0f, 0.0f, 0.0f); boxTrail1.Width = 0.5f; boxTrail1.UpdateInvisible = true; // Create second box for face camera trail demo with 4 column. // This will produce less distortion than first trail. boxNode2 = scene.CreateChild("Box2"); var box2 = boxNode2.CreateComponent <StaticModel>(); box2.Model = cache.GetModel("Models/Box.mdl"); box2.CastShadows = true; var boxTrail2 = boxNode2.CreateComponent <RibbonTrail>(); boxTrail2.Material = cache.GetMaterial("Materials/RibbonTrail.xml"); boxTrail2.StartColor = new Color(1.0f, 0.5f, 0.0f, 1.0f); boxTrail2.EndColor = new Color(1.0f, 1.0f, 0.0f, 0.0f); boxTrail2.Width = 0.5f; boxTrail2.TailColumn = 4; boxTrail2.UpdateInvisible = true; // Load ninja animated model for bone trail demo. var ninjaNode = scene.CreateChild("Ninja"); ninjaNode.Position = new Vector3(5.0f, 0.0f, 0.0f); ninjaNode.Rotation = new Quaternion(0.0f, 180.0f, 0.0f); var ninja = ninjaNode.CreateComponent <AnimatedModel>(); ninja.SetModel(cache.GetModel("Models/NinjaSnowWar/Ninja.mdl")); ninja.SetMaterial(cache.GetMaterial("Materials/NinjaSnowWar/Ninja.xml")); ninja.CastShadows = true; // Create animation controller and play attack animation. ninjaAnimCtrl = ninjaNode.CreateComponent <AnimationController>(); ninjaAnimCtrl.PlayExclusive("Models/NinjaSnowWar/Ninja_Attack3.ani", 0, true, 0.0f); // Add ribbon trail to tip of sword. var swordTip = ninjaNode.GetChild("Joint29", true); swordTrail = swordTip.CreateComponent <RibbonTrail>(); // Set sword trail type to bone and set other parameters. swordTrail.TrailType = TrailType.Bone; swordTrail.Material = cache.GetMaterial("Materials/SlashTrail.xml"); swordTrail.Lifetime = 0.22f; swordTrail.StartColor = new Color(1.0f, 1.0f, 1.0f, 0.75f); swordTrail.EndColor = new Color(0.2f, 0.5f, 1.0f, 0.0f); swordTrail.TailColumn = 4; swordTrail.UpdateInvisible = true; // Add floating text for info. var boxTextNode1 = scene.CreateChild("BoxText1"); boxTextNode1.Position = new Vector3(-1.0f, 2.0f, 0.0f); var boxText1 = boxTextNode1.CreateComponent <Text3D>(); boxText1.Text = "Face Camera Trail (4 Column)"; boxText1.SetFont(cache.GetFont("Fonts/BlueHighway.sdf"), 24); var boxTextNode2 = scene.CreateChild("BoxText2"); boxTextNode2.Position = new Vector3(-6.0f, 2.0f, 0.0f); var boxText2 = boxTextNode2.CreateComponent <Text3D>(); boxText2.Text = "Face Camera Trail (1 Column)"; boxText2.SetFont(cache.GetFont("Fonts/BlueHighway.sdf"), 24); var ninjaTextNode2 = scene.CreateChild("NinjaText"); ninjaTextNode2.Position = new Vector3(4.0f, 2.5f, 0.0f); var ninjaText = ninjaTextNode2.CreateComponent <Text3D>(); ninjaText.Text = "Bone Trail (4 Column)"; ninjaText.SetFont(cache.GetFont("Fonts/BlueHighway.sdf"), 24); // Create the camera. CameraNode = scene.CreateChild("Camera"); CameraNode.CreateComponent <Camera>(); // Set an initial position for the camera scene node above the plane CameraNode.Position = new Vector3(0.0f, 2.0f, -14.0f); }