Documentation/Code Snippets
From NeoAxis Engine Wiki
| Language: | English • Русский | Status: | Not Approved |
How to Calculate Rotation (Quaternion)
float angle = 30; float halfAngle = angle * 0.5f; Quat rot = new Quat( new Vec3( 0, 0, MathFunctions.Sin( halfAngle ) ), MathFunctions.Cos( halfAngle ) );
or in simple way:
Quat rot = new Angles (0, 0, 30).ToQuat();
Exposing Variables and Functions to Logic Editor
This class should be in GameEntities.dll.
//make Class Visible in LogicEditor [LogicSystemBrowsable( true )] public class MyClass { //Declare private variable static int myVariable = 0; //Make public get/set function visible in LogicEditor [LogicSystemBrowsable( true )] static public int MyVariable { get { return myVariable; } set { myVariable = value; } } //Make function visible in LogicEditor [LogicSystemBrowsable( true )] static public bool MyFunction( string a, string b ) { if( a == b ) return true; return false; } }
How do I create a particle system without having to attach it to an object?
Use the following code:
ParticleSystem particleSystem = SceneManager.Instance.CreateParticleSystem(particleSystemName); SceneNode sceneNone = null; if (particleSystem != null) { sceneNone = new SceneNode(); sceneNone.Position = pos; sceneNone.Attach(particleSystem); }