Sticking like a method actor..
smurfted
Member, PRO Posts: 586
If i want one actor to stick to another i got it working. The old costrain x,y & angle to the scene attribute x,y & angle.
But when it rotates, it doesnt stay in the right place as it turns. This is because its off center. How can i fix this so it looks attached to the other actor?
Comments
This is a weird set of sentences... Could you clarify witch "it" is what actor?
Mental Donkey Games
Website - Facebook - Twitter
I have a tank and i have a turret, i can stick the turret to the very center of the tank but it needs to be off center..
Do i really need to use the "cos" & "sin" functions in a mad math dash?
What does that mean? What is a mad math dash and what are you referring to when you write "cos" & "sin" (yes, I know they are trig functions but they weren't mentioned in this thread)?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
It'd be helpful if you added a little more detail (and clarity!) to your question, I don't know what a 'mad math dash' is (geometry dash style game?), as Nipa said 'This is a weird set of sentences'.
EDIT: found 'mad math dash' game, but I'm not sure how it relates to your questions ?
https://www.vtechda.com/Store/ITMax/ContentDetail/US_eng_1668_58-126800-000-036_False.html
Sorry i wasn't meaning that game. I simply meant it was needing complicated maths (trigonometry).
The only way (i found) for me to stick one actor to another actor was by using a constraint behavior with a mathematical formula that references game attributes i harvested earlier. It just seems a bit long winded..
I did get it working in the end & can share if someone else has this problem..
Ah! Sorry, I completely misunderstood !
The maths is pretty straightforward, you are just constraining the 'child' actor's x and y position to a multiple of the cos and sin of the 'parent' actor's rotation.
If you don't want to have to do math, you could just make the image of your turret twice the length that it needs to be, then have the rotating point of the turret be the middle of the image. It takes up slightly more ram, but it's also a pretty straightforward way of doing it. If collisions are a problem give it custom collision just around the turret and not in the big empty space.
I suggest trying out the other method however, so you can learn how it works and what it does so you can use it in the future.
Vote for Nearest Neighbor Scaling option in gamesalad! Let's make our games look truly stunning!
+1
Epic. Cheers for the idea Owen-Dennis.
I did get it working with the maths, though i have to say it wasn't helped by the math sometimes not working properly, then working when i did exactly the same equation for a second time (has anyone else had that problem?!).
@smurfted said:
It only takes one . , ( ) etc... in a wrong place to brake the expression. It's sometimes hard to spot the error.
Mental Donkey Games
Website - Facebook - Twitter
True, maybe it was me..
Sad I got to this thread too late to make a Daniel Day Lewis joke
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support