On 1.2.1 b version I created a test simple project with physics.
On the scene you can see a sphere and simple hull. Sphere it is dynamic rigid body, and hull it is static rigid body.
Sphere has scale (2,2,2)
I rotated camera and changed gravity on the sphere. It worked fine.
It is camera script:
var time = (float) Game.UpdateTime.Total.TotalSeconds;
Entity.Transform.Rotation = Quaternion.RotationZ((0.1f*time%2f)*(float) Math.PI);
var sphere = this.SceneSystem.SceneInstance.Scene.GetChildren().FirstOrDefault(e => e.Name == "sphere");
if (sphere != null)
{
var physicsComponent = sphere.Get(PhysicsComponent.Key)[0];
if (physicsComponent != null)
{
var rigidBody = physicsComponent.RigidBody;
if (rigidBody != null)
{
rigidBody.Activate(true);
rigidBody.OverrideGravity = true;
var angle = Entity.Transform.Rotation.Angle;
rigidBody.Gravity = new Vector3((float)Math.Sin(angle), -(float)Math.Cos(angle), 0) * (10);
}
}
}
But after update studio to 1.2.2 b, the sphere after contact with static rigid body changed scale and go out on the camera. I dont know it is bug or not, but it behaviour it not correct.
I found solution - if you change the scale of the sphere to (1,1,1) it will work fine for 1.2.2b, but sometimes the sphere change scale uncontrolled. It is a temporary solution.
Please see to my project and help me maybe I am doing wrong.
- Run project (on 1.2.2b) and look on the sphere.
- Stop project.
- Change scale on the sphere to (1,1,1).
- Run project and look on the sphere.
You can download project here