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: + A Vector3 Away From A Position Vector3

Previous Thread :: Next Thread 
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
16 Nov 2014 06:56 PM
So, I recently discovered that you can place objects a certain space away from a Position (Vector3 value).

For example, if you wanted to place a brick on your characters head, as a function, you would do


a = Instance.new("Part", game.Workspace)
a.Position = game.Workspace.YOURNAMEHERE.Head.Position + Vector3.new(0,1,0)


But the question is, is there any other way to do something like this without adding a Vector3 value to the head position?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Nov 2014 07:04 PM
Well you could do:
local pos = game.Workspace.YOURNAMEHERE.Head.Position

a = Instance.new("Part", game.Workspace)
a.Position = Vector3.new(pos.X, pos.Y + 1, posZ);

But why don't you want to add a Vector3?
Report Abuse
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
16 Nov 2014 07:07 PM
@cnt

No reason. Just wondering if there were any alternatives.

I actually discovered the Vector3 adding all by myself.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Nov 2014 07:08 PM
Thank metatables for that.
You should also look up multiplying a V3 by a constant.
Adding a V3 to a CF
Multiplying a V3 to a CF
Multiplying a CF to a CF

(CF meaning CFrame and V3 meaning Vector3)
Report Abuse
UnvaryingC0DER is not online. UnvaryingC0DER
Joined: 10 Aug 2014
Total Posts: 173
16 Nov 2014 07:10 PM
@cnt

Ok, but I won't do too much work with CFrames. I'm still new to lua.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
16 Nov 2014 07:11 PM
I understand that CFrames and what not use tables, but if so, why doesn't Roblox add a "Type" property to it?

print(Part.Position.Type)
-->Vector3

It would be so much easier than using pcalls to check type.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Nov 2014 07:12 PM
Well I mean usually you wouldn't need the type, but I guess it would be useful.
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