nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 26 Sep 2012 11:46 AM |
I'm trying to get p1 to slowly look at p2, so the final frame should be:
p1.CFrame = CFrame.new(p1.Position, p2.Position)
but I have only tried to do this and have no idea how I can do this. I don't want to have to use slerp to do this because I believe there is a more simple way to accomplish this. Anyone know how I can do this without the use of slerp? |
|
|
| Report Abuse |
|
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 26 Sep 2012 11:49 AM |
What's slerp?
You could try to use a BodyGyro with a high dampening |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 26 Sep 2012 11:49 AM |
| Er, the code I had posted was an example, not the real scenario. I'm doing this with the camera's CoordinateFrame. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 26 Sep 2012 12:05 PM |
I think you would need a loop and some maths to make it slowly turn towards a position with CFrame.
IMO, you should make the script add an invisible part inside the camera, along with a BodyGyro inside that set to face the position. Then all you would have to do is game.Workspace.CurrentCamera.CFrame = game.Workspace.CurrentCamera.Part.CFrame
|
|
|
| Report Abuse |
|
|
|
| 26 Sep 2012 12:06 PM |
BodyGyros are a great way to do rotations, by letting the engine take care of it it will look better. Although if you can't use a body gyro for one reason or another and slerp is too complicated then the use of nlerp can be a close substitute. It is extremely simple and works almost the same as slerp.
I haven't tested this code but something like this should work:
function Nlerp(start, finish, percent) return start:Lerp(finish,percent).unit end |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 26 Sep 2012 12:08 PM |
"IMO, you should make the script add an invisible part inside the camera, along with a BodyGyro inside that set to face the position. Then all you would have to do is"
No, don't want to do that. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 26 Sep 2012 12:08 PM |
| What is this lerp everyone but me seems to know about ._. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 26 Sep 2012 12:21 PM |
http://wiki.roblox.com/index.php/Vector3
Look at :Lerp. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 26 Sep 2012 07:31 PM |
Use interpolation with a scaled function as the input:
for t: 0->1 CFrame = Interpolate(CFrame.new(at, from), CFrame.new(at, to), (t-1)^3+1)
You can steal the interpolation code from my Wiki page. |
|
|
| Report Abuse |
|
|