# Gravitation Behavior - Beta

New releases and general discussions.

### » Fri Jul 10, 2009 8:29 pm

question:
when an object is absorbed, does supposed to add the mass of the object to the object that didn't get absorbed?

also, an idea, could object size changing according to mass should be a multiplier you can set, to make it more general?
like 0 would mean there would be no change in size regardless of mass,
and 1 would be the way it is now
10 would be 10 times more size difference per part mass
I mean, what if you wanted to make super gravity guy, the tiny alien with gravitation powers, who can absorb objects at will, but you never wanted his size to change?

and maybe a starting mass property, so you can decide the scale of your game, I might want a 10x10 pixel star to be an ultra heavy object in my game.

supercool stuff though
and it's interesting to see where that line of questioning in the plugins forums was leading
Spriter Dev
B
103
S
22
G
12
Posts: 3,283
Reputation: 17,147

### » Fri Jul 10, 2009 10:12 pm

[quote="lucid":3vyndtv6]when an object is absorbed, does supposed to add the mass of the object to the object that didn't get absorbed?[/quote:3vyndtv6]
Yes. The smaller object's mass is added to the larger object.
B
2
S
1
G
3
Posts: 27
Reputation: 1,054

### » Fri Jul 10, 2009 11:24 pm

Awesome. Really.

Demo reminds me of this:
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

### » Mon Jul 13, 2009 9:45 pm

Again, thanks for all the feedback, guys. I've added some extra resizing options for the next version. There's now a "Resize" check box and a "Size multiplier" field for more(any) control over resizing.

The bouncing is turning out to be harder to implement than I thought. And this is for true circle/circle bouncing, not just going back the direction the ball came. The math is pretty complex and I can't seem to find a good method that doesn't require really fancy stuff.
Moderator
B
114
S
41
G
20
Posts: 1,586
Reputation: 19,161

### » Mon Jul 13, 2009 10:47 pm

I think this may help linkman
http://files.getdropbox.com/u/1013446/ballangles.cap
left and right arrow aim
mouse moves arrow
left mouse button fires ball

the only event that matters for your purposes is the "on collision" one
I believe that is correct normal based reflection though

basically :

normal = angle(object1.x,object1.y,object2.x,object2.y)
angle r = normal - object1.angle (the angle it was moving)

the normal is the angle between the centers of the two objects upon collision
I have to minus 180 in my example so it's facing back outward
then you just subtract angle r from the normal to get angle i

I just noticed as I was typing this though, that your problem might have become complex because of the multiple balls being reflected and not stationary...but I think the same basic rules should apply
Spriter Dev
B
103
S
22
G
12
Posts: 3,283
Reputation: 17,147

### » Tue Jul 14, 2009 8:26 am

I was trying to make a Katamari kind of thing, but ran into a lot of flaws. If this had a compatability with the Physics behaviour, it would be really cool.
B
55
S
12
G
9
Posts: 339
Reputation: 9,604

Previous