[HELP]What native is this mod using?

I want to mimic the “caught” object movement when fishing, as it flies from spawned location to where player is… Is this a native?

1 Like

Personally, I do that by applying force to the spawned fish, I guess this mod use the same way
https://runtime.fivem.net/doc/reference.html#_0xC5F68BE9613E2D18

I am running into a problem, I already have the fish spawn in front of the player using forward X and forward Y then getting the heading and creating the fish ped using those values

but, when I use

ApplyForceToEntity(fish, 0, playerPos.x, playerPos.y, playerPos.z, playerPos.x + (frontx * 10), playerPos.y + (fronty * 10), 0, false, false, true, true, false, true)

The fish only comes straight at me (somewhat at a fast speed too lol) at a certain heading where I am facing, if I change where the player is facing it shoots out in other directions :frowning: does this native not have a heading?

EDIT (The fish already spawns facing the player 100% times)

The float x, y, z parameters of this native are the direction you want the force to push and how hard you want it to push.
You cannot use player coordinates, that’s not how it works.

I use a vector which is the difference between where the fish spawn and where I want him to go, this way I only get the necessary forces to move him to me.

Like this:

local x = fishEndPos.x - fishStartPos.x
local y = fishEndPos.y - fishStartPos.y
local z = fishEndPos.z - fishStartPos.z
ApplyForceToEntity(fish, 3, x, y, z, 0.0, 0.0, 0.0, 1, false, false, true, false, false)

I also suggest you use MAX_FORCE_ROT_2 (p1 = 3) to have enough force to push the fish.

1 Like

is this an offset of where the player is?

It is where you want the fish to go.
Remember you give a DIRECTION to the force, not coordinates.

OMG DUDE it worked!!! now I need to find a way to give the ma bit of a force upwards so they get IN the boat xD thank you

Well, you can easily do that by putting the ending position of the fish upward so the force will push the fish to the sky :wink:

just the Z ending value or you mean all of them?

Think of it this way:

The “blue arrow” is a vector, it has 3 directions (each direction is composed of an axis + a force).
Its origin is your fishStartPos and the arrow head is fishEndPos.

if you want your fish to get UP, you need to set Z in fishEndPos to a higher value :slight_smile:

1 Like

Do you know if water makes it harder for the fish to jump out? I think that’s what my issue is, I think I am spawning them too low and the water breaks the speed down :frowning:
thanks for all the help by the way :smiley:

I didn’t test that but I spawn the fish above the water since it is easier to manager :wink:

I am pretty sure that the fish is spawning above water now +2

but it still feels like its just focusing on going up instead of forward where the player is, if I remove the +10 to the Z then it sort of feels better but the fish cant get in my boat

		local x = playerPos.x - fishPos.x
		local y = playerPos.y - fishPos.y
		local z = (playerPos.z + 10) - fishPos.z
		ApplyForceToEntity(fish, 3, x, y, z, 0.0, 0.0, 0.0, 1, false, false, true, false, false)

Why can’t it get on the boat?
It collide with the boat before getting high enough?

if it is, then you can set you ending position closer to the boat edge.

I can see them sort of “jumping” to the boat, but then they just fall off not even 5 feet from the boat :frowning: look

they just go straight down

I even tried using the boat now as the ending point instead of player :frowning:

		local x = boatPos.x - fishPos.x
		local y = boatPos.y - fishPos.y
		local z = (boatPos.z + 5) - fishPos.z
		ApplyForceToEntity(fish, 3, x, y, z, 0.0, 0.0, 0.0, 1, false, false, true, false, false)
1 Like

I think I am missing a bit more force, do you know if I can give them a bit more?

You will need to try and tweak the coordinates to find the good forces.
To make your life easier for tweaking, use:

GetOffsetFromEntityInWorldCoords(playerPos, 0.0, 0.0, 0.0)

It returns coordinates of the entity with the amount of offset you want.
So if you want to get the coordinates behind your player, you set y to a negative value
ie: GetOffsetFromEntityInWorldCoords(playerPos, 0.0, -8.0, 0.0)

Left/Right is X and Up/Down is Z.

Just remember the farthest it will be from the fish spawn point, the harder it will push it.

1 Like

we did it fam :slight_smile: thanks for the help!

Kinda weird I need an offset of like 25!

now the question remains… how long do I keep them “on the boat” for? lol

Any chance you would share this amazing achievement? thats a pretty neat little script

@Bob_74 do you know if you can change the mass or weight of a ped? sharks flip over the tug even though the tug is a huge boat