Need help with Collision Shapes
Games4life
Member, PRO Posts: 279
Hi GS Community!
I'm a little confused on what exactly collision shapes are… If some can please explain to me what exactly they are that would be a huge help!
Thanks for your help in advance!
~G4L
Comments
It is the shape that the actor will use to detect other objects when colliding.
So if you had a ball actor, you would want to set its collision shape to circular.
@Socks Thanks for your input, but when I click circular collision shape the grey rectangle still pops up on my actor. My actor is a fish so would I put the collision shape at circular?
Thanks,
~G4L
I don't know what that means, I don't know what 'the grey rectangle' is, or why it would 'pop up' ?
An actor's collision shape has no visible effect on an actor, by that I mean it won't make an actor grey or any other colour.
Is your fish circular ?
@Socks Yes my fish is circular although it has the width of a rectangle. What I meant was, my drawing is smaller than the actual 30 by 30 scale I have it set to. The square my drawing is in is bigger than the drawing. The square I speak about is the one when you click on an actor in the scene mode or initial scene. That is grey rectangle around the actor I was talking about.
Sorry if this is not clear and thanks for all your help so far!
~G4L
An ellipse ?
Unfortunately GameSalad only supports circles and rectangles.
Not sure what that means, is the actor size 30 pixels by 30 pixels ?
I see, maybe screenshots would help ?
@Socks Yes an ellipse could possibly work. How would someone make an ellipse using collision shapes?
Here is the "grey square" I was talking about. The actor size box is actually 30 by 30 pixels but the drawing is smaller as seen in the screenshot below. Any advice on to crop that box to my drawing is greatly appreciated!
prntscr.com/5xq062
Thanks,
~G4L
Open the image in the Preview application, drag the selection rectangle around the fish and then choose Crop from one of the menus.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank you very much!
You can make an ellipse collision shape with a few actors (set to circular collision shape) - more actors = more accurate . . . less actors = more efficient.
. . . . . . . . . .
Fast Constrain project:
https://forums.gamesalad.com/discussion/75220/fast-constrain-linkmachine-v2
Very helpful thank you very much! @Socks
@Socks
Once again thank you very much for the video. Although i am experiencing another problem with the collision shapes. The fish actor is actually being spawned by a spawner. Is there any way I can merge the collision shape and the fish actor together as one actor so they can be spawned together as one?
Thanks for all your help so far,
~G4L
With a single fish, it's pretty easy to constrain a spawned actor to another spawned actor through the use of two game attributes (e.g. game.fishX and game.fishY) With multiple fish, it's not as easy but still doable with tables. My health bar demo shows how to do this: http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Thank you for the demo! Although I am very confused on the whole idea of tables and the constrain attributes. I have attached a screenshot as to what i want the fish to look like once it comes out of the spawner. This is a picture of the collision shape on top of the fish.
Thank you very much for your help!
~G4L
http://prntscr.com/5zfgt6
Edit: I forgot to tag you sorry
The way my health bar demo works is that right before the constrained actor spawns, I change an index value (1, 2, 3, ...). When the actor spawns, it changes a self attribute to match that value. So each spawned actor then has a table row number that it constantly checks. That row corresponds to the "player" actor that it will be constrained to. The player actor also has a unique row number that matches it and constantly updates that row. This is how the two actors "talk" to each other. If you were to spawn a fish with say five circular actors constrained to its position, then you'd use the health bar method but give each circle an offset value (center-40, center-20, center, center+20, center+40).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang If I were to do this, would this be able to spawn the collision shape on top of my spawned fish actor at the same time? If so how?
Thanks,
~G4L
Have you tried out my health bar demo?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Yes although I am confused as to what rules and other attributes I am supposed to use and not use.
Thanks for all your help so far,
~G4L