Actor Is Not Following Constrain Code With Rotation

kirklandkirkland Removed Posts: 268
edited November -1 in Working with GS (Mac)
hi

i was wondering if anybody can help with one of my actors which not following the constrain code when the other actor is rotation.

can anybody help please
«1

Comments

  • kirklandkirkland Removed Posts: 268
    any ideas
  • aandiaandi Member Posts: 99
    yh any ideas
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    stop posting with your 2 accounts trying to act like different people.
  • aandiaandi Member Posts: 99
    i am sorry i really am. please may you help
  • aandiaandi Member Posts: 99
    any ideas. i know it is not just me with this
  • aandiaandi Member Posts: 99
    any ideas
  • RodericRoderic Member Posts: 145
    Tell us what code you have that is not working? We need more info, because if you used the behaviors properly you should not have this problem. So, be more explicit, explain exactly what you have in the code. Then maybe we can help you.
  • aandiaandi Member Posts: 99
    um

    what bit do i needd to give you. the constrain or rotation
  • aandiaandi Member Posts: 99
    hi here goes

    the constrain for my triangle is

    constrain attribute is game.playersx to self.position.x
    self.positon.y to self.position.y

    the rotation script is for my triangle is
    actor receives event/ mouse button/ is down

    constrain attribute self.position to
    vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )

    my script for my bar which needs to be constrain to the triangle is (steelplatform is bar)

    constrain to the triangle script is
    (change attribute) self.position.y to scene.Background.steelplatform.Position.Y +5
    (change attribute) self.position.x to scene.Background.steelplatform.Position.X

    basically i want the bar (steel platoform) to be constrained to the triangle but when ever you rotate the triangle the bar (steel Platofrm) needs to rotate with it.

    any ideas now
  • aandiaandi Member Posts: 99
    any ideas
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Generally if you want two actors to move and rotate together as one single unit, its easiest to just have them be one single unit.

    Just go to your favorite graphics program and copy and paste the graphics of the two objects together. Then save as a .png. Then import it into GameSalad and put that single image on one single actor.

    hope this helps,
    RThurman
  • aandiaandi Member Posts: 99
    i don't think you get it. if you do this then a ball will never go down a ramp which in my case is an triangle. that is why i got the bar (steel Platform)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    aandi said:
    i don't think you get it. if you do this then a ball will never go down a ramp which in my case is an triangle. that is why i got the bar (steel Platform)

    You are correct. I don't get it.

    So this sentence is not true, "basically i want the bar (steel platoform) to be constrained to the triangle but when ever you rotate the triangle the bar (steel Platofrm) needs to rotate with it." As far as I can tell, you want both objects to move in the same x,y relationship, and you want them to rotate to the same angle. You want to use some behaviors to essentially weld them together into one unit. Why not do that with one actor.

    In your graphics program, just lay out the steel bar horizontally along the top edge. Then lay out the triangle graphic underneath it. (You may need to rotate the triangle graphic in relationship to the steel bar. For example, the 'ramp' edge of the triangle will need to fit right up against the edge of the steel platform.)

    Then when you import the graphic into GameSalad and place the image on an actor, the top of the 'steel platform' will conform to the top of the actor. Then, place the actor on the scene and rotate it so that the steel platform is sloping downward at the angle you need. If your graphic has the correct relationship between triangle and steel bar, then (in the scene) the triangle will also look correct.

    Doing this graphically will save memory and processing speed.
  • aandiaandi Member Posts: 99
    but the steel platform needs to be invisible (transparent) so the ball can rool down the triangle ramp
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    It will be a square, but most of the square will be _under_ the ramp. (Not on top like you are worried about.) The squareness won't interfere with the ball if you do it this way.

    In the graphic, the point of the triangle will point downward. But when you put it on the scene, you can rotate the actor all you want. Like this:

    Photobucket

    (The triangle is a little off because your original triangle wasn't quite in the proper relationship to the bar.)
  • aandiaandi Member Posts: 99
    what about being drag as well.

    have you got any ideas of what i can put in the code.
  • aandiaandi Member Posts: 99
    ok i know how to drag and drop. but shawly game salad will think it is an saquare and the ball will bounce of the square and not roll down the triangle.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Oh... you really did mean drag (as in friction).

    Go into both actor prototypes (ball and triangle) and under the physics attributes, mess with density, friction, and restitution (and all the rest) till both actors behave just right. (For example, uncheck 'Moveable,' but do check 'Fixed Rotation' on the triangle's physics attributes.)
  • aandiaandi Member Posts: 99
    can i send it to you my project
  • aandiaandi Member Posts: 99
    no i get that right ok i know. but the bar you attached will not rotate when the triangle does. even though i put the code in. the bar as soon as i go to drag the triangle ends up being verticle. and not rotating with the triangle. please help. but telling me what to do. i have spent ages on this.

    p.s i don't want you to take a look at it. i want to do it my self
  • aandiaandi Member Posts: 99
    so i put the

    (constrain attribute) game.rotation in the triangle or the ramp

    is it both
  • aandiaandi Member Posts: 99
  • aandiaandi Member Posts: 99
    oh never mind done thanks so much
  • aandiaandi Member Posts: 99
    ok i did that but

    two more things. now when ever i have finished rotating my triangle it goes back to the original position from when i started rotating.

    and the bar does not follow the constrain position. like you constrained for me.

    any ideas
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    aandi said:
    can i send it to you my project

    Um.... no. You are doing fine. It is good for you to do it on your own. And asking questions is a good way to learn this stuff.

    But you need to ask specific questions that are well thought-out. It is the way that people ask questions that helps me to understand what they are capable of doing. For example, your questions have not been about specific behaviors (code) you are looking at (except for a general plea to fix the behaviors you do not seem to understand yet). So, I know that you are not ready for the code to pin actors together. That is why I suggested that you combine graphics instead. (And the fact that the single actor approach saves memory and processing cycles.)

    And no.... harping, pleading, and continually bumping two separate threads is not an indicator that you are capable of 'getting it' yet!

    Here is a way to perhaps get specific help from this (or any) forum. A way that will not make people feel that they are going to end up doing the whole thing for you.

    1) Describe what you want your project to do. (And why.)
    2) Pick one specific fixable chunk to work on at a time, and describe it.
    3) Explain what you have done (so others know what level you are on, and how you are approaching it).
    4) Explain what the results have been so far and how it differs from what you expected.
    5) Then (and only then) ask a specific question about what you can do to get it to work like you expect.
    6) Be willing listen to other suggestions and alternative approaches. There probably will be a better approach than the one you are using.

    For example, I watched for days and days as you bumped your thread(s). But without something specific to respond to -- it does no good. Then when you responded to Roderic and gave some specific 'code' I could then see what your objective was. Then you gave a specific description of what you want. You wrote, "basically i want the bar (steel platoform) to be constrained to the triangle but when ever you rotate the triangle the bar (steel Platofrm) needs to rotate with it."

    With that kind of information, I am able to give you a specific answer. (And the answer still stands. Just use one actor.) I even took the time to modify a graphic to show you how to do it.

    But if you ask a generic question (like the one about drag), then (at best) you will get a generic answer. But most of the time, you will just get ignored, or told to go look it up.

    I am not trying to be a stinker. I really am trying help you to help yourself.

    RThurman
  • aandiaandi Member Posts: 99
    ok

    can i do an recording and show you what is happening and the codes. is that ok
  • aandiaandi Member Posts: 99
    as you can see whenever i try to roate the triangle it goes back to normal position

    and the white bar stays horizontal all the time i want it right up against the triangle

    here is the video it features codes as well

    http://www.screencast-o-matic.com/watch/cXQ0q4ZrU

    and in this case the black thing is the white bar in the picture below but if you watch the video the white bar stays horizontal

    http://imageshack.us/photo/my-images/813/drawingsketch.png/

    please comment back
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    aandi said:
    please comment back

    It is times like this when I feel quite disposed to repeat the immortal words of Captain Marko Ramius (as portrayed by Sir Sean Connery).

    Captain Ramius: Re-verify our range to target... one .png only.
    Vasili Borodin: Captain, I - I - I just...
    Captain Ramius: Give me a .png. ... One .png only, please.
    Vasili Borodin: Aye, Captain.
  • aandiaandi Member Posts: 99
    why it will not work. can you make me an demo.
Sign In or Register to comment.