Suggestion for Ball behaviour + a physics bug

New releases and general discussions.

Post » Sat Aug 02, 2008 2:43 pm

I don't suppose it would be possible to add a set X component and set Y component to the Ball behaviour would it?

Plus while I'm writing, are you aware that the ellipse collision mask for the new physics engine is a perfect circle regardless of the dimensions of the physics object?

Thanks
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sat Aug 02, 2008 6:19 pm

I was messing with the ellipse as well, and I noticed it doesn't roll unless it's tilting off another object. It's not a big issue for me, but I did think it looked a little odd.
B
2
G
4
Posts: 71
Reputation: 1,192

Post » Sat Aug 02, 2008 6:35 pm

Yeah, the new physics engine has a few bugs. We'll try have them sorted for the next build.

I'll add that to the ball behavior quickly...
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sat Aug 02, 2008 6:47 pm

Actually, for ball behavior, all you need to set the X and Y components are:

Set angle of motion to angle(0,0,x,y)
Set speed to distance(0,0,x,y)

Do you think I should add special actions? :P
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sat Aug 02, 2008 10:32 pm

I was originally doing something like that but what I found was, since i was using variables for my 'Xforce' and 'Yforce', it messed up the bounces pretty hardcore. The object was trying to push through obstacles rather than bounce off them since the X/Y components were 'set in stone' so to speak and it was hard to alter the variables upon collision to make the ball bounce off at the right angle.

If you don't think it's appropriate to add them, that's fine, I guess I am using the ball behaviour a little differently than it should be used.
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Mon Aug 04, 2008 7:39 pm

I'm using the platform behavior to make balls fall in a specified direction depending on which way gravity pulls them. To disable jumping, you just set the jump strength to zero. I'm sure that's not how the behavior was intended to be used. :lol:
B
2
G
4
Posts: 71
Reputation: 1,192

Post » Tue Aug 05, 2008 1:41 am

I'm at college so i can't check, but does the platform movement bounce? I'm really using the ball movement so i don't have to code realistic bounce formulas
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Tue Aug 05, 2008 6:03 pm

You combine the behaviors and disable the gravity of the ball behavior. You have to adjust the settings a lot to get it to act the way you want it to, but I'm positive it works, because I did it myself.

Here's a link to the cap I was using the behaviors in: CLICK HERE!
It has a few bugs and needs a lot of work, but it works.
B
2
G
4
Posts: 71
Reputation: 1,192

Post » Wed Aug 13, 2008 2:56 am

Sorry to ressurect this slightly older thread, I've been unable to use my internet for a long time. Thanks for the suggestion fantasyjam but i think what i want is slightly different.
What i want to do is similar to the movement that i made in my super speed example in the 'your creations' forum.
I want to update the X and Y components of movement every tick to give a controlled 'space' type movement. I can get the movement moving exactly how i want it to move, except i can't for the life of me code in the right collision code.

See with something like:
set angle of motion (0, 0, Xvariable, Yvariable)
set speed to distance (0, 0, Xvariable, Yvariable)

The movement works prefectly, until you collide with something, the ball/player just tries to keep going through the obstacle rather than bounce off because it's X and Y components of motion are fixed into variables rather than being updated upon a collision, meaning, so is the angle of motion.

What i would like (semi pseudo code):
Always:
set angle of motion (0, 0, Ball X component, Ball Y component)

When W(forward) is down:
set ball X component to ball X component + (cos(player angle) * AccelerationVariable)
set ball Y component to ball Y component + (sin(player angle) * AccelerationVariable)

If i could alter the ball movements X and Y components directly, just like i can in platform or physics, i would still be able to get the spacey type motion but bounces would work perfectly fine too because the ball behaviour works out which angle to bounce at and changes the X/Y components accordingly. It would also open up more avenues for advanced ball movement controls, like what you're doing, you could easily make multiple gravity wells.
I hope i made myself clear enough :S

Anyway, to summarise my post, I'm begging you Ashley to add set X/Y components to ball behaviour!!!!!! :D
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Wed Aug 13, 2008 12:39 pm

Maybe you're better off writing a custom ball movement? As you mentioned, if you're always overriding the velocity, when it bounces it's still trying to go in the old direction, and you need to update the variables.

Adding set x/y component won't magically fix this, because the action will just call set angle of motion and set speed for you, with the math. So it'll work exactly like it does with your current method.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests