Sticking like a method actor..

smurftedsmurfted 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

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276
    edited February 2016

    @smurfted said:
    But when it rotates, it doesnt stay in the right place as it turns. This is because its off center.

    This is a weird set of sentences... Could you clarify witch "it" is what actor?

    Mental Donkey Games
    Website - Facebook - Twitter

  • smurftedsmurfted Member, PRO Posts: 586

    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..

  • smurftedsmurfted Member, PRO Posts: 586

    Do i really need to use the "cos" & "sin" functions in a mad math dash?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @smurfted said:
    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

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2016

    @smurfted said:
    Do i really need to use the "cos" & "sin" functions in a mad math dash?

    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

  • smurftedsmurfted Member, PRO Posts: 586

    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..

  • SocksSocks London, UK.Member Posts: 12,822

    @smurfted said:
    Sorry i wasn't meaning that game. I simply meant it was needing complicated maths (trigonometry).

    Ah! Sorry, I completely misunderstood ! :D

    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.

  • owen_dennisowen_dennis Just a guy, you know. Member, PRO Posts: 236
    edited February 2016

    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.

  • SocksSocks London, UK.Member Posts: 12,822

    @owen_dennis said:
    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.

    +1

  • smurftedsmurfted Member, PRO Posts: 586
    edited February 2016

    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?!).

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276
    edited February 2016

    @smurfted said:

    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?!).

    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

  • smurftedsmurfted Member, PRO Posts: 586

    True, maybe it was me..

  • ArmellineArmelline Member, PRO Posts: 5,368

    Sad I got to this thread too late to make a Daniel Day Lewis joke :(

Sign In or Register to comment.