Pull an object

Pull an object

Re: Pull an object Posted by Livett on Fri Jan 21st 2005 at 4:50pm
Livett
164 posts
Posted 2005-01-21 4:50pm
Livett
member
164 posts 46 snarkmarks Registered: Dec 24th 2004 Occupation: Student Location: England
I am making a kind of cross between a catapult and a trebuchet.

I have it set up so that the arm is being held down by a rope, and you can pull a lever to which deactivates the length constraint and causes the arm to swing upwards because of the counter weight.

I need to make it so that another button pulls the arm back down to it's original position to be reloaded with ammunition. I have tried just turning the length constraint back on but it pulls the arm back to it's original position so fast that smashes into the floor and falls off it's hinge.

So any ideas on how to slowly pull an object back into posisition?
Re: Pull an object Posted by Rof on Fri Jan 21st 2005 at 5:00pm
Rof
210 posts
Posted 2005-01-21 5:00pm
Rof
member
210 posts 41 snarkmarks Registered: Dec 3rd 2004
I'm not sure about phys_lengthscontraint, but I think that phys_spring can take an input that can set it's length.

So you could add a phys_spring that's is usually turned off.

Then when it comes to reset the catapult, turn on the spring, and
gradually shorten it (using multiple outputs and the "delay" field to
make the spring gradually shorter over ~30 seconds or so).

That should make it pull the arm more smoothly, and the fact that it's
a spring should make it less abrupt, anyway. (You might want to turn
the "force only on stretch" spawnflag on, that should prevent the arm
oscillating.)

Then when the spring has pulled back the arm, turn on the phys_lengthconstraint again, and turn off the spring.

You'll probably have to play with the timing and the spring constant, friction, etc., to make it look good.
Re: Pull an object Posted by Livett on Fri Jan 21st 2005 at 5:03pm
Livett
164 posts
Posted 2005-01-21 5:03pm
Livett
member
164 posts 46 snarkmarks Registered: Dec 24th 2004 Occupation: Student Location: England
I will give that a try now
Re: Pull an object Posted by Livett on Fri Jan 21st 2005 at 5:08pm
Livett
164 posts
Posted 2005-01-21 5:08pm
Livett
member
164 posts 46 snarkmarks Registered: Dec 24th 2004 Occupation: Student Location: England
The spring can't be turned on or off. Also it couldn't pull the arm back down.
Re: Pull an object Posted by Dred_furst on Fri Jan 21st 2005 at 5:14pm
Dred_furst
455 posts
Posted 2005-01-21 5:14pm
455 posts 135 snarkmarks Registered: Sep 3rd 2003 Location: UK
try getting a phys_thruster to push the catapault back down, then
re-enable the constraint when the phys_thruster hits a trigger.
Re: Pull an object Posted by Rof on Fri Jan 21st 2005 at 5:23pm
Rof
210 posts
Posted 2005-01-21 5:23pm
Rof
member
210 posts 41 snarkmarks Registered: Dec 3rd 2004
Hmm. You could set the spring length to be really long to turn if "off"
(that way, as long as you have "force only on stretch" on, it won't
interfere with the catapult operation).

And you might have to set the spring constant to a really high value to make it pull a heavy object. F = -kx, and all that.
Re: Pull an object Posted by Nickelplate on Fri Jan 21st 2005 at 6:26pm
Nickelplate
2770 posts
Posted 2005-01-21 6:26pm
2770 posts 346 snarkmarks Registered: Nov 23rd 2004 Occupation: Prince of Pleasure Location: US
keep your original setup only add a spring that pullsthe trebuchet upwards. then the spring should let the end down slowly enough that It wont bust off the hinge.