User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Phizix - keep two objects together

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Phizix - keep two objects together

    In the Phizix chipmunk engine I want to keep two objects together with relative points so that they are completely melted to eachother.

    It's hard to explain, but I kinda want this effect:

    That no matter what angle they're at, they're still positioned relatively to eachother, and both work with the collision.

  2. #2
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    Attach a pin joint between their centers... Or add them both to the same body i you want to lock their relative rotation as well.

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    Quote Originally Posted by Werbad
    Or add them both to the same body i you want to lock their relative rotation as well.
    Silly of me not thinking of that!

    But how do I keep their relative positions?

  4. #4
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    Set the hotspot of both objects to the center of the merged body

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    But there's no way to set the hotspot during runtime am I right?

    Also, if I did this method of yours, would the blocks still keep their individual collision?

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    You have two options here.

    If you want the two cubes to be represented via a single physical body and attach two actives to it without having to set their hotspot positions to the center of the physical body, you'll have to create your own manual positioning events, rather than using the 'attach active' features that Phizix provides.

    The second option is to create two pivot joints between the bodies. The pivot points of the two joints should set to the positions of each of the bodies. This will lock the angles of the objects to each other as well.

    Both methods has it's advantages and disadvantages. The first one is definitely a bit more clean, but it can potentially be more complicated (at least the part about figuring out how to position the cube objects from the event editor).

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    Quote Originally Posted by Nifflas
    The second option is to create two pivot joints between the bodies.
    This one worked beautifully

  8. #8
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    A new question, is there any way to completely freeze an object's X or Y position? Whenever I use "always set X/Y position" or "on loop set X/Y position", if you hit the object with another object really hard it still bounces. Is there any way to freeze these positions completely?

    (also when I set the positions I also set the velocity to 0)

  9. #9
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    Remove and recreate it as a static object.

  10. #10
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Phizix - keep two objects together

    There's another method to lock an object's X and Y position without locking the angle or angular speed. I always keep a static body (which I call the 'lock body') in the game that is removed from all collision layers. To lock the x/y positions of an object, just create a pivot joint from from the 'lock body' to your object. The position of the pivot point should be the same as the object you're locking.

    Werbad's solution should be used to completely freeze your object including it's angle. Your object will also lose all it's connected joints with this method.

    My solution should be used when you only want to freeze the position, but not it's angular speed.


Page 1 of 2 1 2 LastLast

Similar Threads

  1. Phizix Box2D - Interaction with regular objects ?
    By donmanolo in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 22nd January 2012, 10:09 AM
  2. Phizix for Iphone (box2d and phizix)
    By iamjot in forum Extension Development
    Replies: 8
    Last Post: 6th May 2011, 08:41 AM
  3. Phizix - Pinning objects statically
    By Dines in forum Extension Development
    Replies: 7
    Last Post: 11th June 2008, 04:35 AM
  4. Phizix - Objects out of collisions
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 30th January 2008, 05:02 AM
  5. Phizix - would this be possible?
    By Tiny in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 24th December 2007, 01:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •