Custom Collision Shapes?

If I wanted to make a ramp with realistic collision (not exactly straight but like an exponential curve), how could I go about doing that, if it would be possible?

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    I do not think this is possible yet.
  • Zenith_GameworksZenith_Gameworks Member Posts: 310
    :(
  • Zenith_GameworksZenith_Gameworks Member Posts: 310
    If it came with pro I would definitely buy it.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Custom collision shapes are not available in GameSalad. The two possible collision shapes are rectangle and circle. It's possible to make ramps using a series of rectangles rotated to form a smooth-ish surface, but it's a pain to do so.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited February 2013
    Curves are possible without using too many rectangles...



    Darren.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    Custom collision shapes are not available in GameSalad. The two possible collision shapes are rectangle and circle. It's possible to make ramps using a series of rectangles rotated to form a smooth-ish surface, but it's a pain to do so.
    You could plot them automatically with an expression.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You could plot them automatically with an expression.
    True. Actually, I have a game I started working on pre-tables that involves curved surfaces and I'm ready to return to it now that I can pre-determine the locations, sizes, and rotations of actors via a table.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • eoineoin Member, PRO Posts: 36
    Custom collision shapes are not available in GameSalad. The two possible collision shapes are rectangle and circle. It's possible to make ramps using a series of rectangles rotated to form a smooth-ish surface, but it's a pain to do so.
    You could plot them automatically with an expression.
    Please tell me how I can find out more about this technique?

  • SocksSocks London, UK.Member Posts: 12,822
    Please tell me how I can find out more about this technique?
    @eoin

    What I mean is that you can use an expression to draw a series of 'dots' (small actors) to define the edge of the curved surface:

    Example 1: http://www.mediafire.com/?vrnms26lr5a0v9h

    Example 2: http://www.mediafire.com/?bnho5bu7xaldiau

    Here is the same thing with the collision points even more spaced out, hopefully you can see that you don't really need them to be that close for a curved collision surface - obviously in the actual game all these collision actors would be invisible - and your graphics with nice smooth corners would sit over the top:

    Example 3: http://www.mediafire.com/?ebhl0dbh477waxi
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @Socks the hills demo is exactly what I was needing for the game I put on hold. The only thing I don't quite get is how to specify the starting y position. In that file, the starting Y value is always 290.467 based on game.Time. What if I want the curve to start at Y=0?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2013
    @tatiang
    . . . how to specify the starting y position. In that file, the starting Y value is always 290.467 based on game.Time . . .
    I'm not 100% sure what you mean ? Not sure where you are getting 290.467 from either (I might just be misunderstanding your question) ?

    80*sin( game.Time *300)+120

    The Y value is 120.
    The 80*sin part at the start of the equation raises and lowers the Y value by 80 pixels.
    The game.Time *300 part defines how fast the 80*sin will raise and lower the Y value.

    . . . . so Y is 120, but it sweeps up to 200 (120 + 80) and sweeps down to 40 (120 - 80).


    If you wanted to have the curve start at 0 (I presume you mean the base of the curve ?) . . then you need to do this . . .

    AAA*sin( game.Time *BBB)+CCC

    AAA = range of sweep
    BBB = speed of sweep
    CCC = centre of sweep

    So, the centre of the sweep needs to be the same as the range of sweep, if the centre is 120 (120 pixels 'off-the-ground'), then the range of sweep needs to be 120, so it sweeps up to 240 pixels and then down to 0 pixels (120 pixels each way).

    So . . . 120*sin( game.Time *BBB)+120


    Hope that makes sense ! (Hope I've understood your question).
  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2013
    @tatiang

    Ah ! I've think I've just understood your question (I think) !?

    Do you mean you want the curve to start at the lowest point in its cycle ?

    i.e: If we have a curve like this, you want it to start on-the-ground ?

    If that's the case, the you just need to offset the angle of the sine by 90°:

    120*sin( game.Time *300-90)+120
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Yes, that's pretty much it. I have hill graphics (which I now need to remake to fit the sin function) but let's say I place a hill somewhere on the scene. I'm trying to figure out how I would make the curve begin (it's lowest point) at self.position.X-self.size.Width/2,Y=0.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2013
    @tatiang
    Yes, that's pretty much it. I have hill graphics (which I now need to remake to fit the sin function) but let's say I place a hill somewhere on the scene. I'm trying to figure out how I would make the curve begin (it's lowest point) at self.position.X-self.size.Width/2,Y=0.
    If you want the sin function (or cos for that matter) to start at 0 (or wherever) then just turn (or 'offset') the angle accordingly (here we are using game.time as the angle so it just keeps rotating automatically), do this by adding (or subtracting, or whatever you want) from the angle.

    AAA*sin( game.Time *BBB-90)+CCC

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Thanks, @Socks. That seems to do the trick!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2013
    This is really rough (graphics-wise and physics-wise) but its exactly what I've been wanting to do: have each hill spawn its own collision shape.

    (ugh, the YouTube timeline gets in the way... just imagine green ground on either side of the hill.)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

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

    Looking good ! :)>-
Sign In or Register to comment.