Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How should I go about making a speed detecting system?

Asked by 5 years ago

Alright, so I develop for a group and the owner keeps pushing me to make a speed radar for his police vehicles, my problem is I have no idea how to go about it...

I've had a few ideas like making the vehicles store a speed value in their car as it changes, but I can't change the coding of any of the civillian vehicles, so that won't work.

I have wondered if there is a way to pull a player's speed, but I have no clue about that.

Any and all suggestions or ideas about what to do for this will be a huge help to me... Anything will help related to this issue.

0
Velocity is distance/time. Just calculate how much distance the car goes in x amount of time. User#21908 42 — 5y
0
As Phlegethon said, use the formula for velocity. I generally just run a spawn function which holds an old point (p1) and a new point (p2), and check their magnitude. Then divide the magnitude by the spawn function's interval rate. SummerEquinox 643 — 5y

2 answers

Log in to vote
0
Answered by
ozzyDrive 670 Moderation Voter
5 years ago

All objects affected by physics will have their Velocity property change depending on the moving direction and speed of the object. The length of the vector is the object's speed: object.Velocity.Magnitude (studs/s).

0
Alright, so I'm trying to use raycasting to find a part, any idea how I can get it to return what the part was? CryptoBloodXaos 13 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

The speed detector set up

Part A:

Part B:

A loop that increments each second

Distance is pre-calculated when you place the distance between part A and B which is divided by the time and displayed on the detector as a surface gui.

Answer this question