Jump to content

Recommended Posts

Posted

Hello! What is the problem with raycasting? What do I do wrong, I get the loop finished after the first raycasting check, though the line is drown correctly, not intersecting any map objects (raycasting type 1 is the map)?

```
    time = 0;
    while (checker)
    {
        time = time + 0.1;
        //some x1, x2, y1, y2, z1, z1 changes
        let hitData = mp.raycasting.testPointToPoint(new mp.Vector3(x1, y1, z1), new mp.Vector3(x2, y2, z2), [], 1);
        if (!hitData)
            checker = false;
    }
    mp.events.add('render', () =>
    {
        mp.game.graphics.drawLine(x1, y1, z1, x2, y2, z2, 255, 0, 0, 255); //correctly shown in mid-air
    });
    mp.game.graphics.notify('!' + x2 + ' ' + y2 + ' ' + z2 + ' ' + time); //time == 0.1
```

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...