|
BodyGyro doesn't seem to want to cooperate with BodyForce or BodyPosition, so I need a different method. Any ideas? |
|
RoflBreadJoin Date: 2009-06-18 Post Count: 3803 |
|
|
RoflBreadJoin Date: 2009-06-18 Post Count: 3803 |
But why shouldn't a bodyGyro work with bodyForce? Set it so the gyro makes it face where you want to go, and have bodyForce apply force on the rocket's lookVector. |
|
|
@Rofl
I don't know. It just seems like BodyGyro never works with other body objects. |
|
|
Nevermind, I got it with BodyGyro+BodyForce. I just had to set the maxTorque of the BodyGyro to a ridiculously huge number. |
|
|
Works even better with BodyPosition :) |
|
TwiIightJoin Date: 2011-11-19 Post Count: 334 |
while true do wait()
missile.CFrame = CFrame.new(missile.Position,Target.Position)*CFrame.new(0,0,1)
end |
|
|
BodyGyro and BodyVelocity together are the two best objects for anything flying |
|
|
Adding to what crazyman said, don't forgot the make sure that part's front side is actually facing the front.
~+[CROOKITY BANDED SNAKES]+~ |
|
|
^
I would do what crazyman says cause HE would know.
:D btw I LOVE your Perilous skys game. :D |
|
|
Now making the missile track is a whole different story. Yes, making it simply follow the target isn't that hard. Just point it toward the target. But making it shoot in the targets PREDICTED path takes some work. Can be done with speed/dist/time equations. |
|
|
-- Launch up here, assuming that Missile is definined
while Missile.Parent == Workspace do
-- Assuming that TargetTorso is defined
BodyGyro.cframe = TargetTorso.CFrame
BodyPosition.position = (TargetTorso.CFrame*CFrame.new(0,0,-5)).p -- Keeps the missile target 5 studs in front of the Torso
wait()
end
Not fancy, but still not the worst someone could do.
~+[CROOKITY BANDED SNAKES]+~ |
|
|
I used BodyPosition and BodyGyro. I just use a loop to keep the BodyGyro pointed at the target and to make the BodyPosition's position a certain number of studs away from the tip of the missile. |
|
|
Only problem is that you can't really control the speed of a BodyPosition object.
And if you want the scary truth, the missile scripts in Perilous Skies are about 300 lines of code. |
|
|
@crazy
You can control the speed. You just have to make the BodyPosition's position further ahead.
BodyPosition.position = missile.Position + missile.CFrame.lookVector --Very slow
BodyPosition.position = missile.Position + missile.CFrame.lookVector * 100 --Super fast |
|
|
Aye, but that's not precise since it sort of 'tweens' the position. It will work, but I still favor the BodyVelocity movements |
|
|
BodyPosition makes it easier to make it realistic, because it automatically includes acceleration. |
|