#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Make an object stick to another object.

Posts: 88Member
edited December 2011
Hello there GameSaladers, I was wondering if there is a way to make an actor fly on to another and stick to it on impact. Kinda like a stickbomb hitting a car and being stuck onto it as it moves about.

• Posts: 4,630Member
Hi dantuma/Rd
search the creator templates theres one there,
Ill try and make one if you can't find it..
just email me at [email protected]
---------------------------------
Posted by LeonardDeveloper, contact me on [email protected]
Be sure to visit my WEBSITE
Have a look at my GS Tutorials

----------------------------------------------------
Yours Sincerely,
Jack Leonard
• Posts: 88Member
Er, any idea what the pre-made template is called?
• Posts: 4,630Member
Nope! , But i will try and get one working of ryou
• Posts: 9,914Member
Watch the cookbook video on actor distances and modify it to attach to another.
• Posts: 372Member
Well, I think you could do:
Rule
constrain attribute : self x [to] other actor's position x + (other actor's position x - self x)
constrain attribute : self y [to] other actor's position y + (other actor's position y - self y)

To do this you need to create two real game attributes for your main character, setting them to the x and y positions accordingly.
Not sure if it works, but it's worth a shot!
• Posts: 4,630Member
@master200012
It doesn't work very well..... thats what i had originally thought....
• Posts: 6,256Member
make 2 self real attributes in the actor you want to stick. Call them stickX and stickY

Make a rule when actor collides with whatever you want it to stick to:
change self motion linear velocity x to 0
change self motion linear velocity y to 0
change stickX to self position x
change stickY to self position y
constrain self position x to stick x
constrain self position y to stick y

cheers
• Posts: 2,102PRO
Yeah... ^
I was thinking.
Set up a Contraint function.
Boolean called stick.
When overlaps or collides with actor change att Stick to true.
If struck is true "Constrain"
This discussion has been closed.