#Help with Raycast
174 messages · Page 1 of 1 (latest)
shit bro we're on the same boat 😭
Can you tell us a little bit about how you introduce random spread?
maybe with some more code
with math.random()
and how do you add it? its what the xyz is?
local X = math.random(10, 20)
local Y = math.random(10, 20)
local Z = math.random(10, 20)
ok i think i underestand why it does that now.
teach us your ways
I suggested the cframe * cframe jn did it work @rotund glade
Why r u multiplying the vectors
yeah it didnt
U should be adding them
I this case u add
Cuz uk
Lookvector multiply is to increase it's range
Lookvector add is to shift the direction
this happens if i do
anyways thats not the point bro
jit just use chat gpt lmfao
Z has to be negative
did u fixed yours?
Because a positive Z means behind
you dont get it
Technically if he's facing the direction of the x axis
And adds x
Then the spread goes forward
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
I think that's the problem
this shit is giving me headaches
Exactly in relation to the world
Yeah
Not the player
Use cframe
bro
CFrame.Angles would be good
Not if u use it well
I did spray patterns so I did something like this
the code i provided gives you a final result (called direction) that you can use for random spread. It takes the Humanoid's Lookvector and applies some randomness to it.
.
that code is completely different of mine
Here's how youd combine the two (one sec)
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)
What I did was I took the cframe of my camera
Cuz I'm doing a first person shooter
And * by an Cframe
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
(rootpart.CFrame*CFrame.new(X,Y/2, -Z)).Position
the variables?
Everything i pasted would replace the one line you pasted.
me and @olive pike tried that
it didnt work
Personally use angles cuz it's better that way
It does work
Isn't this lookvector not pos btw?
alr lemme just try @wet marten suggestion before
It's doing stuff relative to the rootpart cframe
ok. remember, the last bit of code i pasted, is meant to replace the line you pasted (the one with result in it)
wym
oh
yeah
yeah
did that
whats debounce?
ive heard of it before but idk what it means
if db == true then return end
ohh like. a cooldown basically. sure
yes
lookin good!!!!!!!
Oh I use angles to get this that's why
what are the red things
oh
ngl it depends... i have played a fighting game before called Duckgame that revolves around having no animations
lmao its lagging so fucking much
** You are now Level 9! **
players can change their inputs crazy fast
with no debounces
but then Darksouls is kind of like. the opposite of that
Was it good?
you should make an animaton where when you get hit you get knocked abck
The animations feel heavy
duckgame is insanely good, especially on lan (any amount of lag starts to impact the game quite heavily)
Somehow
i will
in the last m1
the lack of animations makes the game feel quite nice to play (in that game at least)
I'm making csgo zombies where u knockback the zombies with guns
@olive pike
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
Yea ig
Omg... Overwatch 2 !!!!!
Depends on what you're doing
born again!!!!!
it sounds good ahaha
So progress is pretty good
what do the zombies use to move/navigate?
Nah they're real players
i got my raycast to work lets go
this thing is so annoying
It's actual players
member blacklist is deprecated 🙄
And I realised I spent 2h on that for nothing
gg
bro i had to use ai to fix it
yo i paid someone to make this is it good?
as fuck
Nice
It's good
Give the guy a bonus ong
he made 2 i just dont know which ones better
i am bro im taking advanatage of the main one being down
was gonna use htis
aint no way ur doing a skibidi toilet tower defense game 😭
this one looks like a mobile game one
you better shut yo mouth boy
main i paid someone for mine
i can try and make one for you im good at it
i did mine by myself lol
fr?
whats the game abouut
i mean mine doesnt look so bad its the result i was wanting
you dont have to lol dw
oh ok i just got freee time rn
@wet marten @olive pike why is it not hitting sometimes tho?
Idk
thanks for the help!
maybe cuz it's hitting u first
Params.FilterDescendantsInstances = {Character}
what is the filter type?
excluded
is Character ur character or some random character
idk
do u pass the params to the raycast?
