|
| 05 Aug 2016 02:50 AM |
Im creating a bullet/lazer. How to do I tween/move the part to the target point? I got the position, I got the starting position. How do I make it GET there? And without using Lerp, as the closer the target is, the slower the bullet is. And I dont know how to use BodyForce effectively.
|
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 05 Aug 2016 02:52 AM |
| You could use bodyposition. Just set the position to the goal position and set the maxforce and stuff. |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 05 Aug 2016 03:06 AM |
"And without using Lerp, as the closer the target is, the slower the bullet is." If this is the case you're using lerp wrong. However you shouldn't really CFrame bullets until you use them just for the looks and do hit detection with a ray or something. |
|
|
| Report Abuse |
|
|
|
| 05 Aug 2016 03:15 AM |
I am using rays for hit detection. The bullets are just for show.
|
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 05 Aug 2016 03:25 AM |
local startcf = whereeverTheBulletStartsFrom local endcf = whereeverItEndsAt
for i = 1,4 do i = i/4 bullet.CFrame = startcf:lerp(endcf,i) wait() end
idk how smooth that looks though it reaches its destination in 0.12 seconds and if the distance was 100 studs it'd jump 25 studs every .03 seconds
I'd give the above a shot but otherwise use a BodyVelocity, it moves the bullet straight and smoother |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 05 Aug 2016 03:28 AM |
Oh wait I totally misunderstood what you meant with the closer target just use a BodyVelocity |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 05 Aug 2016 03:33 AM |
"tween/move the part to the target point" He should be using a bodyposition undoubtedly. |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 05 Aug 2016 03:48 AM |
I doubt he wants the bullet to stop, BodyVelocity keeps constant speed
local dir = ((startCF*CFrame.new(0,0,-1)).p-endCF.p).unit*speed
BVelocity.Velocity = dir
I never get direction stuff right the first try but that's how I suppose it goes. |
|
|
| Report Abuse |
|
|