[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
71
S
21
G
203
Posts: 3,584
Reputation: 115,072

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!
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Mon Mar 02, 2015 5:19 pm

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

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
71
S
21
G
203
Posts: 3,584
Reputation: 115,072

Post » Sun Mar 29, 2015 3:18 am

Bump. Hoping this can make it into r201.
ImageImageImage
B
71
S
21
G
203
Posts: 3,584
Reputation: 115,072


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests