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 » Scripters
Home Search
 

Re: Making a Character, facing a Mouse Click? (Local Script)

Previous Thread :: Next Thread 
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
16 Aug 2016 10:49 PM
How easy is it to get a Character to face the direction of brick? Mostly.

Basically, I have a pickax tool and I'm trying to face a rock when I click it. Obviously, I don't want the Character to face up or down at all. Just one axis.

Can someone direct me to the correct wiki article? I know it's CFrame related, just unsure of the details.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 10:53 PM
use a bodygyro
or use the torso
and set your chosen to have a CFrame of

CFrame.new(torso.Position,part.Position)

which creates a cframe from pointA pointing at pointB
Report Abuse
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
16 Aug 2016 10:56 PM
This method will work. Unfortunately I was hoping for something a bit more instant. Gyros take a moment to point to its target. Especially if you are point in the exact opposite direction.

Thanks though.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 10:57 PM
^
you can pick between torso cframe or body gyro

also body gyro can turn quickly, you just have no idea how it works

if you understood what P,D,MaxTorque did, you would know it is fully configurable to fit your needs
D is the damping or smoothness
P is the force used
MaxTorque is how much force can be put on all the axis angles
Report Abuse
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
16 Aug 2016 11:03 PM
"also body gyro can turn quickly, you just have no idea how it works"

Not nice.

In anycase, you say Torso CFrame, but that doesn't tell me anything. How do I set the directional CFrame. I know CFrame moves it's position, I know CFrame.Angles turns it, but how do I face it in the direction of a brick without the up and down factor?
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 11:04 PM
I explained to you what the body gyro does and if you decide to act that way against my judgement then so be it but it is pretty easy to isolate the up/down factor but I am too lazy to mess with CFrame.p*Vector3 atm so ask someone else
Report Abuse
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
16 Aug 2016 11:06 PM
I am telling you, I am not looking for the Gyro method, but a more direct CFrame method. If you are "Too Lazy" to give me what I am asking for, then why are you posting? This does not help me.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 11:09 PM
^ CFrame method is not smooth and looks crappier

also just reset the Y position so that it only tracks the X and Z

CFrame.new(torso.CFrame.p*Vector3.new(1,0,1),part.CFrame.p*Vector3.new(1,0,1)) * CFrame.new(0,torso.CFrame.Y,0)
Report Abuse
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
16 Aug 2016 11:18 PM
You are right. CFrame will instantly redirect me. I have used the Gyro method much more then you think in other situations. This situation I need an instant turn. Thank you. This will help me greatly.
Report Abuse
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
16 Aug 2016 11:19 PM
Also the line you gave me is flawed.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 11:25 PM
it works, instead of replacing my words, declare variables

what it does it it will draw a CFrame from pointA to pointB

the difference here is that the positions will have a Y of 0, meaning they arent up or down from eachother
then if you add back the torso Y, you get a CFrame looking towards pointB without looking up or down
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
16 Aug 2016 11:28 PM
blarg u overcomplicated the cframe a lot

torso.CFrame = CFrame.new(torso.Position,Vector3.new(part.Position.X,torso.Position.Y,part.Position.Z))


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Objectly is not online. Objectly
Joined: 18 Jul 2016
Total Posts: 210
16 Aug 2016 11:33 PM
Look at blarg's recent post with his module.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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