databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 28 Jul 2013 02:45 PM |
missile.Missile.CFrame = CFrame.new(plane.Seat.CFrame.lookVector * ((spn.Position - plane.Seat.Position).magnitude + missile.Missile.Size.z/2 + 1), spn.CFrame.lookVector * ((spn.Position - plane.Seat.Position).magnitude + missile.Missile.Size.z/2 + 2))
What I'm trying to do is position the missile facing away from the seat, and spn is the part shooting the missile. I'm trying to make it face a way from the seat, outward from the part shooting the missile, so that the missile shoots away from the seat, despite the spn's direction. I'm trying to make it distance 1 stud away from spn. This makes it spawn in the same direction, but from the co-ordinates (0, 0, 0).
And I have no idea what I'm doing wrong in my math.
Emerson wrote an essay on that |
|
|
| Report Abuse |
|
|
Java3D
|
  |
| Joined: 29 Jul 2012 |
| Total Posts: 1229 |
|
|
| 28 Jul 2013 02:48 PM |
local originalPosition = Seat.Position local targetPosition = target.Position for n=1,(originalPosition-targetPosition).magnitude,.25 do missle.Missle.CFrame = CFrame.new(originalPosition,targetPosition)*CFrame.new(0,0,n) wait() end
|
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 28 Jul 2013 02:52 PM |
@java I don't want it to start at seat, and fly out towards a "Target." Target is not set on the missiles. I want to just set it in the right direction, rather than doing the missile script you just posted.
Emerson wrote an essay on that |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 28 Jul 2013 03:02 PM |
I think I detect one thing. plane.Seat.CFrame.lookVector
That's the way the seat is facing. CFrame.new(plane.Seat.Position, spn.Position).lookVector
That's the way I meant for it to be. look vecter from the seat to the spn.Position.
I just caught myself. That was a stupid mistake.
My new code that still doesn't work:
missile.Missile.CFrame = CFrame.new(CFrame.new(plane.Seat.Position, spn.Position).lookVector * ((spn.Position - plane.Seat.Position).magnitude + missile.Missile.Size.z/2 + 1), CFrame.new(plane.Seat.Position, spn.Position).lookVector * ((spn.Position - plane.Seat.Position).magnitude + missile.Missile.Size.z/2 + 2))
Emerson wrote an essay on that |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 28 Jul 2013 03:04 PM |
Is it that I'm not using lookVector correctly?
Emerson wrote an essay on that |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 28 Jul 2013 03:05 PM |
WAIT, I think it might be that it's going to 0,0,0, cause I'm using lookVector in a fail way. I shall try doing it that + spn.Position.
Emerson wrote an essay on that |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2013 03:10 PM |
Brain,
U started-off, so well, than went back to your gobbled-gook....
local Look = CFrame.new(plane.Seat.Position, spn.Position).lookVector
now u know where u r going. Good start.
Don't try to cram everything into one line, which will never work anyway.....
u have about ten more lines to go to set a missel off in a direction. Take a script, (there must be thousands), which shoot a missle (Take any Roblox gun). Read the code that shoots a missle, and cram your Direction into it...
GL, Brian
|
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 28 Jul 2013 03:12 PM |
missile.Missile.CFrame = CFrame.new(spn.Position + CFrame.new(plane.Seat.Position, spn.Position).lookVector * ((spn.Position - plane.Seat.Position).magnitude + missile.Missile.Size.z/2 + 1), spn.Position + CFrame.new(plane.Seat.Position, spn.Position).lookVector * ((spn.Position - plane.Seat.Position).magnitude + missile.Missile.Size.z/2 + 2))
That's what I finally found out after hours of rage. Problem solved. Continue with all your lives, forummers.
Emerson wrote an essay on that |
|
|
| Report Abuse |
|
|