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: How to make an object line itself in a certain direction given two points in a three dimensional grid

Previous Thread :: Next Thread 
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
23 Oct 2011 04:07 PM
Could someone please help with this? I, being unfamiliar with addressing direction in roblox, do not know how to do this.

Sincerely,
Noobertuber
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
23 Oct 2011 04:10 PM
Take two Vector3's and 'lerp' them.

local position1 = Vector3.new(4,1,73)
local position2 = Vector3.new(6,23,10)

local center = position1:lerp(position2,0.5)
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
23 Oct 2011 04:10 PM
Object.CFrame = CFrame.new(Dir1, Dir2)

while wait() do
  Object.CFrame = Object.CFrame + Object.CFrame.lookVector * 3
end

I think this is what you are talking about.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
23 Oct 2011 04:11 PM
Or to point an object toward another one:

local position1 = Vector3.new(4,1,73)
local position2 = Vector3.new(6,23,10)

local point = CFrame.new(position1,position2)

'point' willl start at its first argument and point toward its second position. Take note that it is a CFrame value, not Vector3.
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
23 Oct 2011 04:23 PM
Spectrum is right.
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
23 Oct 2011 04:33 PM
So, in order to apply it, you would make the CFrame of an object be point? I apologize if the question seems daft; as I said, I have not worked with these before. In any case, thank you for your expedient answers.

Sincerely,
Noobertuber
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
23 Oct 2011 04:38 PM
Yes
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
23 Oct 2011 04:44 PM
Hmmm... I tried that and it seems not to be working. Here is the thing I have

Object = T1
position1 = Vector3.new(P.Character.Head.Position)
position2 = Vector3.new(T1.BodyPosition.position)
Object.CFrame = CFrame.new(position1, position2)
Object.CFrame = Object.CFrame + Object.CFrame.lookVector * 3

In short, there are no output errors, but the object disappears.

Sincerely,
Noobertuber
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
23 Oct 2011 04:50 PM
position1 = Vector3.new(P.Character.Head.Position)
position2 = Vector3.new(T1.BodyPosition.position)

Positions are already Vector3s, so they don't need to be recreated. Replace the lines above with:

position1 = P.Character.Head.Position
position2 = T1.BodyPosition.position
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
23 Oct 2011 04:51 PM
noobtuber, your signature is 2 lines long! Last time I read the rules, that was not allowed.
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
23 Oct 2011 05:07 PM
I just read the rules... Didn't see anything at all about signatures... In addition, it is merely a polite term used at the end of formal messages, and is not technically a signature. Thank you crazy, your solution worked.

Sincerely,
Noobertuber
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
23 Oct 2011 05:18 PM
http://www.roblox.com/Forum/ShowPost.aspx?PostID=53952944
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
23 Oct 2011 05:25 PM
Clans and guilds forum... It is interesting to note that the admin who posted that used two lines... one for her name and one for her signature... How is mine any different?
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
24 Oct 2011 02:49 PM
Well, the mods are mods, nothing we can do about THAT :s
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