x


How to use character controller to push down hinge joint properly

I am working with my finished Lerpz tutorial trying to learn about unity. What I am currently trying to do is make a hinged bridge which Lerpz can push down. The bridge will then rise when Lerpz isn't on it any more.

this is what the setup looks like:

-I used the crate mesh (only mesh) from "Build your Own!" in the project pane to make a Domino shape (by scaling down x-axis). Onto that mesh I added a boxcollider, a rigidbody and a hingejoint component (with no connected body).

I have encountered some problems which I hope you could help me with!

-I have trouble getting Lerpz to push it down (he understands the collision, but does not act upon it like a rigidbody). I have tried adding a rigidbody to "Player" and also "Player->Lerpz", but that doesn't work. How would you propose doing this in a beautiful manner?

What I've done to make it work is to make another rigidbody crate and use that as a child of "Player" to push down objects, but it just doesn't feel right :D

I appreciate any thoughts you got! /Z

more ▼

asked Feb 18 '10 at 12:55 PM

ZanzibarDreams gravatar image

ZanzibarDreams
273 10 12 22

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Just a quick thought, don't know if it really is the best way to do it but:

You could add a trigger on the bridge to detect Lerpz, then raycast a ray from lerps down to the bridge to calculate the hit point, then add a force to the bridge at this point.

more ▼

answered Feb 18 '10 at 11:52 PM

Jaap Kreijkamp gravatar image

Jaap Kreijkamp
6.4k 20 26 70

Thanks I'll give it a try!

Feb 19 '10 at 08:15 AM ZanzibarDreams

I solved it, not using a trigger but raycasting from Lerpz to the bridge and using AddForceAtPoint. Since I have a spring on the bridge it is quite twitchy, so I have to find a good distance and angle for the ray to be cast(so i can stand on the bridge aswell). Thanks!

Feb 19 '10 at 03:11 PM ZanzibarDreams
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1865
x1783
x1040
x519
x57

asked: Feb 18 '10 at 12:55 PM

Seen: 2731 times

Last Updated: Feb 18 '10 at 12:55 PM