generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: I CANT HANDEL DE MATH

Previous Thread :: Next Thread 
databrain is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image