Beispiel #1
0
        /// <summary>
        /// Creates a VPObject from a native instance's attributes
        /// </summary>
        internal VPObject(IntPtr pointer)
        {
            Action      = Functions.vp_string(pointer, StringAttributes.ObjectAction);
            Description = Functions.vp_string(pointer, StringAttributes.ObjectDescription);
            Id          = Functions.vp_int(pointer, IntAttributes.ObjectId);
            Model       = Functions.vp_string(pointer, StringAttributes.ObjectModel);
            Time        = DateTimeExt.FromUnixTimestampUTC(Functions.vp_int(pointer, IntAttributes.ObjectTime));
            ObjectType  = Functions.vp_int(pointer, IntAttributes.ObjectType);
            Owner       = Functions.vp_int(pointer, IntAttributes.ObjectUserId);

            Position = new Vector3
            {
                X = Functions.vp_float(pointer, FloatAttributes.ObjectX),
                Y = Functions.vp_float(pointer, FloatAttributes.ObjectY),
                Z = Functions.vp_float(pointer, FloatAttributes.ObjectZ)
            };

            Rotation = new Quaternion
            {
                W = Functions.vp_float(pointer, FloatAttributes.ObjectRotationAngle),
                X = Functions.vp_float(pointer, FloatAttributes.ObjectRotationX),
                Y = Functions.vp_float(pointer, FloatAttributes.ObjectRotationY),
                Z = Functions.vp_float(pointer, FloatAttributes.ObjectRotationZ)
            };
        }
Beispiel #2
0
 /// <summary>
 /// Creates and adds a new vpObject
 /// </summary>
 /// <param name="model">Model name</param>
 /// <param name="position">Vector3 position</param>
 /// <param name="rotation">Quaternion rotation</param>
 public void AddObject(string model, Vector3 position, Quaternion rotation)
 {
     AddObject(new VPObject
     {
         Model = model,
         Position = position,
         Rotation = rotation
     });
 }