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 do I correctly use lookVector?

Previous Thread :: Next Thread 
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
09 Jun 2013 12:17 PM
So - here's part of my script (the variables are above in the script, this is an extract):

mouse.Move:connect(function()
cambrick.CFrame=CFrame.new(cambrick.Position,mouse.Hit.p)
mouse.KeyDown:connect(function(walk)
if walk=="w" then
cambrick.CFrame=CFrame.new(cambrick.CFrame+cambrick.CFrame.lookVector*1)
end
end)
end)

Now, this makes the camera leap forward a long way, why? I assume it should only leap forwards a stud, which is what I'm trying to make it do.
Any ideas?
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
09 Jun 2013 12:20 PM
Sorry, I meant:

mouse.Move:connect(function()
cambrick.CFrame=CFrame.new(cambrick.Position,mouse.Hit.p)
mouse.KeyDown:connect(function(walk)
if walk=="w" then
cambrick.CFrame=CFrame.new(cambrick.Position+cambrick.CFrame.lookVector*1)
end
end)
end)

Any ideas why? The camera brick is meant to follow the mouse, and W is meant to make it go forwards a stud.
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
09 Jun 2013 12:47 PM
Bump, anyone?
All I need to know is what to do, to stop it from leaping 50 studs.
Report Abuse
iceywind is not online. iceywind
Joined: 10 Aug 2009
Total Posts: 4424
09 Jun 2013 12:53 PM
I forgot what LookVector was.
Sorry, but I can't help out at the moment, not until I get the definition of a LookVector.

Making ROBLOX Better, One Forum Post at a Time™.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
09 Jun 2013 01:05 PM
[ Content Deleted ]
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
09 Jun 2013 01:27 PM
@Oysi
It works fine in the .Move connection for me.
Tried what you suggested. It still appears to leap a really far distance for no reason.
I'll try to explain. The part is at 0,0,0. After pressing W and having my mouse on the far end of the baseplate, it travels in that direction, but looks like it travels 5x as far as its meant to.

After asking @RenderSettings he suggested to * CFrame.new(5,0,0) instead of what you said. I get the same result.

I don't see any reason why it does this.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
09 Jun 2013 01:33 PM
[ Content Deleted ]
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
09 Jun 2013 01:35 PM
@Oysi
ok - now I feel stupid
thanks lol

was just about to smash my screen in
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
09 Jun 2013 01:40 PM
[ Content Deleted ]
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