public static void LoadToObject(Component game, ref RigibodyData data, string mat) { var obj = game.GetComponent <Rigidbody2D>(); if (obj == null) { return; } obj.rotation = data.rotation; obj.velocity = data.velocity; obj.angularVelocity = data.angularVelocity; obj.useAutoMass = data.useAutoMass; obj.mass = data.mass; obj.centerOfMass = data.centerOfMass; obj.inertia = data.inertia; obj.drag = data.drag; obj.angularDrag = data.angularDrag; obj.gravityScale = data.gravityScale; obj.bodyType = data.bodyType; obj.useFullKinematicContacts = data.useFullKinematicContacts; obj.isKinematic = data.isKinematic; obj.freezeRotation = data.freezeRotation; obj.constraints = data.constraints; obj.simulated = data.simulated; obj.interpolation = data.interpolation; obj.sleepMode = data.sleepMode; obj.position = data.position; obj.collisionDetectionMode = data.collisionDetectionMode; if (mat != null) { obj.sharedMaterial = new PhysicsMaterial2D(mat); } }
public unsafe override void Load(FakeStruct fake) { data = *(RigibodyData *)fake.ip; sharedMaterial = fake.buffer.GetData(data.sharedMaterial) as string; }