|
Hi Guys, I am working on a game similar to air hockey. I want to restrict the movement of puck to xz axis. Currently when i hit the puck it travels in y axis with some units too. but i dont want it to leave the base ever. plz help..................
(comments are locked)
|
|
you could use Rigidbody.constraints if you are using a rigidbody... Unity could not find RigidbodyConstraints when i tried it even though its there on unity site. Maybe you will have better luck in findng out how to use it. If you do use it, do share... you could use: rigidbody.constraints = RigidbodyConstraints.FreezePositionY; Source: http://unity3d.com/support/documentation/ScriptReference/Rigidbody-constraints.html
(comments are locked)
|
|
You could add the following to the Update function in the script attached to your puck: Hi, Thnx fr the reply... but it still moves a bit in y position... Actually I have 2 pucks.. I hit 1 puck with other using power. But in some cases, what happens is puck 1 goes over the puck 2.... ? What to do plz help bro
Jan 06 '11 at 11:11 AM
user-8010 (google)
When you say 'goes over' do you mean it goes up and over or it just goes 'through' the other puck?
Jan 06 '11 at 11:30 AM
Meltdown
It goes up and over, not thru...
Jan 06 '11 at 11:42 AM
user-8010 (google)
You could try Rigidbody.useGravity = false; on each puck. This should get rid of the force being applied to them in the y direction.
Jan 06 '11 at 11:45 AM
cjmarsh
did that but no use... Its happening at random. Sometimes the puck travels in y and sometimes it doesnt...plz help
Jan 07 '11 at 05:34 AM
user-8010 (google)
(comments are locked)
|
|
the "dirty" update version works, but did anybody figure out how these constraints actually work?
(comments are locked)
|
