[Request]Set world gravity as a vector

Discussion and feedback on Construct 2

Post » Mon Mar 02, 2015 3:41 pm

I wanted to be able to roll a ball around a mobile screen as you rotate the device through a 360 degree rotation. Even though the Physics engine supports gravity as a vector, C2 only supports changing gravity in Y.

Acts.prototype.SetWorldGravityVector = function (gx,gy)
{
//if (g === this.behavior.worldG)
// return;

this.world.SetGravity(b2Vec2.Get(gx, gy));
//this.behavior.worldG = g;

// Wake up every physics instance
var i, len, arr = this.behavior.my_instances.valuesRef();

for (i = 0, len = arr.length; i < len; i++)
{
if (arr[i].extra.box2dbody)
arr[i].extra.box2dbody.SetAwake(true);
}
};
ImageImageImage
B
70
S
19
G
141
Posts: 3,328
Reputation: 83,238

Post » Mon Mar 02, 2015 4:48 pm

+ lots of support for this and any other improvements that allow users access to more than the current tiny bit of the physics engine!
B
63
S
15
G
57
Posts: 2,138
Reputation: 36,863

Post » Mon Mar 02, 2015 5:19 pm

Not sure but i think you can do this with R0J0hound's Chipmunk behavior.
B
45
S
16
G
9
Posts: 1,096
Reputation: 11,138

Post » Mon Mar 02, 2015 5:49 pm

I actually tried Chipmunk at first but wasn't impressed. Adding it to C2 was very easy - just want to see it official.
ImageImageImage
B
70
S
19
G
141
Posts: 3,328
Reputation: 83,238

Post » Sun Mar 29, 2015 3:18 am

Bump. Hoping this can make it into r201.
ImageImageImage
B
70
S
19
G
141
Posts: 3,328
Reputation: 83,238


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests