Here is my code,
This is, a rather hacky but working script for allowing me to carry things like suitcases, but I hate how bad it looks when I take out a gun or anything, because it just stays in the same place, it only turns when I turn sideways.Code:@name Righ hand orientation @inputs @outputs @persist Vector:vector A P Y R interval(2) A+=(0.1 * 150) Vector=owner():attachmentPos("anim_attachment_RH")-(entity():pos()-vec(0,0,20)) applyForce($Vector*15+Vector) entity():setMass(1) E=entity() Dir = E:owner():right():toAngle() P = angnorm(Dir:pitch() - E:angles():pitch()) Y = angnorm(Dir:yaw() - E:angles():yaw()) R = angnorm(Dir:roll() - E:angles():roll()) E:applyAngForce(ang(P+$P,Y+$Y,R+$R)*2) E:isWeldedTo():setMass(0.01)
Anyone out there who can help me with this?
EDIT: Before I forget, its E2 not E1.
Also, if anyone can take a look at my follower code, both are based on the same code because it seemed less time consuming to edit the hand code to make a follower...
Code:@name Follower @inputs @outputs @persist Vector:vector A P Y R interval(2) A+=(0.1 * 150) Vector=owner():attachmentPos("anim_attachment_head")-(entity():pos()-vec(0,0,20)) applyForce($Vector*15+Vector) entity():setMass(1) E=entity() ENT=entity:pos() OWN=owner:pos() Dir = E:owner():forward():toAngle() P = angnorm(Dir:pitch() - E:angles():pitch()) Y = angnorm(Dir:yaw() - E:angles():yaw()) R = angnorm(Dir:roll() - E:angles():roll()) E:applyAngForce(ang(P+$P,Y+$Y,R+$R)*2) E:isWeldedTo():setMass(0.01) if (ENT-OWN>120) {applyForce(entity():pos())
Seems to break on the last line...


LinkBack URL
About LinkBacks




Reply With Quote

Bookmarks