Talking to a single corner of an actors rectangle?
croc0000
Member Posts: 11
How do I constrain the behaviour of a corner (bottom-left) of the rectangle that defines my actor?
Comments
Change the centre-of-mass, and then apply a 'Pin'.
Is it possible to control two corners of an actor?
'control' is an entirely arbitrary idea ! Without context It could mean anything.
Sorry. Apply constraint rules to two corners. The idea being both the front and back forks of a bike. I can attach the bike frame to the front wheel, but I have been trying to constrain the frame to follow both the wheels and I need to differentiate between the front of the rectangle and the back.
Could I constrain the max X and min Y of the frame to the front wheel and the Min X and Min Y to the back? I was trying stuff like that, but it didn't seem to work?
Min and max are mathematical functions, like multiply, add, sin or floor.
max(A,B) returns the larger value of A and B.
min(A,B) returns the smaller value of A and B.
Example:
max (100,30) = 100
max (100,109) = 109
max (22,9) = 22
min (100,30) = 30
min (100,109) = 100
min (22,9) = 9
What do you mean by 'the max X and min Y of the frame' ?
Of the bike frame (actor) that is "hopefully sitting "on" the wheels. In other words, the bottom left (minX,minY of the actor) constrained to back wheel, and bottom right (maxX,minY of the same actor) constrained to front wheel.
Min does not mean the leftmost or lowermost coordinate of an actor nor does Max mean the rightmost or uppermost coordinate of an actor, the min and max functions have nothing to do with actor coordinates.
how about constraining the bike frame to the front wheel and the back wheel to the bike frame?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I understand what your saying Socks, thank you. I tried that jamie, but the frame wouldn't rotate around the front wheel, once I constrained it. And the bounce of the back wheel created issues with it's attachment to the Frame,... or it would just sit in the middle of the frame
Did you try my suggestion from the other thread ?
Your bike looks and works great. I will post no more.
You can do it mathematically if you really want to, it's not too complicated, just a little trigonometry and a few constrains, but the 'mechanical' route using a collision shape to hold the bike to the wheels is much easier, requires no rules, behaviours or any kind of code at all and works really well, I'd personally go the mechanical route, but like I say you can position the bike elements with maths too.