#Help with Raycast

174 messages · Page 1 of 1 (latest)

lyric cairn
#

im on the exact same thing with my tower defense game its hard man

rotund glade
wet marten
#

Can you tell us a little bit about how you introduce random spread?

#

maybe with some more code

rotund glade
#

with math.random()

wet marten
#

and how do you add it? its what the xyz is?

rotund glade
wet marten
#

ok i think i underestand why it does that now.

rotund glade
#

teach us your ways

olive pike
#

I suggested the cframe * cframe jn did it work @rotund glade

uncut elbow
#

Why r u multiplying the vectors

rotund glade
#

because of lookvector

#

duh

uncut elbow
olive pike
#

I this case u add

#

Cuz uk

#

Lookvector multiply is to increase it's range

#

Lookvector add is to shift the direction

rotund glade
#

anyways thats not the point bro

lyric cairn
#

jit just use chat gpt lmfao

uncut elbow
rotund glade
uncut elbow
#

Because a positive Z means behind

rotund glade
#

you dont get it

olive pike
#

Technically if he's facing the direction of the x axis

#

And adds x

#

Then the spread goes forward

wet marten
# rotund glade teach us your ways

basically, the way youre introducing randomness is wrong, i think because youre adding randomness in relation to the world
this is how ive seen bullet spread done before


local RNG = Random.new()
local TAU = math.pi * 2    

local directionalCF = CFrame.new(Vector3.new(), Character.HumanoidRootPart.CFrame.LookVector)
local MinAngle = 0.1
local MaxAngle = 10
local direction = (directionalCF * CFrame.fromOrientation(0, 0, RNG:NextNumber(0, TAU)) * CFrame.fromOrientation(math.rad(RNG:NextNumber(MinAngle,MaxAngle)), 0, 0)).LookVector
olive pike
#

I think that's the problem

rotund glade
#

this shit is giving me headaches

olive pike
uncut elbow
olive pike
#

Not the player

uncut elbow
#

Use cframe

rotund glade
#

bro

olive pike
#

CFrame.Angles would be good

rotund glade
#

the same thing happens if i use cframe

#

and it gotta return a position

uncut elbow
olive pike
#

I did spray patterns so I did something like this

wet marten
rotund glade
wet marten
rotund glade
#

how the fuck would i do that here

local Result = game.Workspace:Raycast(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.CFrame.LookVector * Vector3.new(X, Y/2, Z), Params)
olive pike
#

What I did was I took the cframe of my camera

#

Cuz I'm doing a first person shooter

#

And * by an Cframe

rotund glade
#

that would work for a first person game

#

which is not my case

wet marten
# rotund glade how the fuck would i do that here ```lua local Result = game.Workspace:Raycast(C...

local RNG = Random.new()
local TAU = math.pi * 2    

local directionalCF = CFrame.new(Vector3.new(), Character.HumanoidRootPart.CFrame.LookVector)
local MinAngle = 0.1
local MaxAngle = 10
local direction = (directionalCF * CFrame.fromOrientation(0, 0, RNG:NextNumber(0, TAU)) * CFrame.fromOrientation(math.rad(RNG:NextNumber(MinAngle,MaxAngle)), 0, 0)).LookVector
local Result = game.Workspace:Raycast(Character.HumanoidRootPart.Position,direction * 10, Params)--i put 10, put whatever you want as the length. the default length is 1.

here it is put on top

uncut elbow
wet marten
rotund glade
#

it didnt work

olive pike
olive pike
#

And show us

uncut elbow
olive pike
rotund glade
uncut elbow
wet marten
rotund glade
#

shit bro

#

its working

wet marten
rotund glade
#

now

#

should i debounce the rays?

wet marten
#

ive heard of it before but idk what it means

rotund glade
rotund glade
wet marten
rotund glade
#

yes

wet marten
rotund glade
#

oh thanks

#

but

#

should i?

olive pike
lyric cairn
#

what are the red things

rotund glade
#

raycast

#

the rays

lyric cairn
#

oh

wet marten
#

ngl it depends... i have played a fighting game before called Duckgame that revolves around having no animations

rotund glade
#

lmao its lagging so fucking much

gaunt groveBOT
#

studio** You are now Level 9! **studio

wet marten
#

players can change their inputs crazy fast

#

with no debounces

#

but then Darksouls is kind of like. the opposite of that

olive pike
lyric cairn
#

you should make an animaton where when you get hit you get knocked abck

olive pike
wet marten
# olive pike Was it good?

duckgame is insanely good, especially on lan (any amount of lag starts to impact the game quite heavily)

olive pike
#

Somehow

rotund glade
#

in the last m1

wet marten
#

the lack of animations makes the game feel quite nice to play (in that game at least)

olive pike
#

I'm making csgo zombies where u knockback the zombies with guns

rotund glade
wet marten
#

your character just insantly responds to any input, you can even pick up and fire a gun on the same tick by pressing the buttons simultaneously

olive pike
wet marten
olive pike
#

Depends on what you're doing

wet marten
#

born again!!!!!

olive pike
#

I swear it's cool

#

I'm implementing spray patterns now

wet marten
#

it sounds good ahaha

olive pike
#

So progress is pretty good

wet marten
#

what do the zombies use to move/navigate?

olive pike
#

Nah they're real players

lyric cairn
#

i got my raycast to work lets go

olive pike
#

I tried to do npc pathfind

#

But the owner said

rotund glade
#

this thing is so annoying

olive pike
#

It's actual players

rotund glade
#

member blacklist is deprecated 🙄

olive pike
#

And I realised I spent 2h on that for nothing

rotund glade
lyric cairn
#

bro i had to use ai to fix it

olive pike
#

I did get the npc to work tho

#

I had a memory leak in it before but I fixed itagony

lyric cairn
#

yo i paid someone to make this is it good?

rotund glade
#

as fuck

olive pike
#

It's good

#

Give the guy a bonus ong

lyric cairn
#

he made 2 i just dont know which ones better

olive pike
#

The first one

#

Skibidi toilet yo u one of those cash grabbers

rotund glade
#

man

#

raycast is kinda

#

weird

#

im ngl

lyric cairn
rotund glade
#

sometimes it hits

#

sometimes it doesnt

lyric cairn
#

was gonna use htis

rotund glade
#

aint no way ur doing a skibidi toilet tower defense game 😭

lyric cairn
#

this one looks like a mobile game one

lyric cairn
rotund glade
#

this will be my game logo

#

not really good

#

im not a designer so

lyric cairn
#

i can try and make one for you im good at it

rotund glade
#

i did mine by myself lol

lyric cairn
#

whats the game abouut

rotund glade
#

i mean mine doesnt look so bad its the result i was wanting

#

you dont have to lol dw

lyric cairn
#

oh ok i just got freee time rn

rotund glade
olive pike
#

Idk

rotund glade
#

thanks for the help!

uncut elbow
rotund glade
#

Params.FilterDescendantsInstances = {Character}

uncut elbow
rotund glade
#

excluded

uncut elbow
#

is Character ur character or some random character

rotund glade
#

exclude

#

its me

uncut elbow
#

idk

uncut elbow
rotund glade
#

this is so wierd