#rahhhhhh

236 messages · Page 1 of 1 (latest)

clever wing
#

ok

#

lets go back to the drawing board

#

alright

#

theres 2-3 things you need

#

to know

#

Raycast, Magnitude Checks and Atan2

#

I'll guide you thru the Atan2

#

since its math

#

but everything else u should be able to handle if u are a scripter

#

theyre not math

pliant blade
clever wing
#

i didnt invite you here

#

so this is our entity

#

facing upwards

#

ok

#

it has a magnitude of 50 studs

#

so anything within 50 studs of itself

#

it should be able to detect

#

and for that

#
local WithinRadar = {}
for _, Character in Characters --[[ make a table w all the characters or sum]] do
  if (Character.PrimaryPart.Position - Bot.PrimaryPart.Position).Magnitude > 50 then continue end
  table.insert(WithinRadar, Character)
end```
#

ok

#

so with this

#

you can detect every enemy 50 studs

#

heres your view now

#

as i referenced befoire

#

your npc is hellen keller until you program it not to be

#

now we've detected every single enemy within a range

#

that we want

#

now first we want to simply the grapth to its lowest

#

before we can raycast

#

so we atan2

#

what atan2 basically does is

#

whatever the fuck this is

#

right

#

and repertor helped me with this

#

for my tower defense so

pliant blade
clever wing
#
local LookCFrame = Bot.PrimaryPart.CFrame
local Rx, Ry, Yz = LookCFrame:ToOrientation()
local AttackingEnemies = {}

for _, Character in WithinRadar do 
    local Delta = (Character.PrimaryPart.Position - Bot.PrimaryPart.Position)
    local Angle = math.atan2(-Delta.X, -Delta.Z)
    local DiffAngle = (Angle - Ry) % (2 * math.pi)
    if DiffAngle > math.pi then
        DiffAngle = (math.pi * 2) - DiffAngle
    end
                
    if math.abs(DiffAngle) < math.rad(15) then
      table.insert(AttackingEnemies, Character)
    end
end```
sonic roseBOT
#

studio** You are now Level 7! **studio

clever wing
#

Character is every other character in the game

#

beside the bot

#

Bot.PrimaryPart.Position is the Bot's humanoidRoot position

#

your filling that table up

#

with all your characters

#
for _, Player in game:Players:GetPlayers() do
  if not Player.Character then continue end
  table.insert(Characters, Player.Character)
end```
#

ok back on track

#

math.rad(15) is in radians how much of the coverage u want

#

so 15 would look something like thius

#

i think

#

where as 90 would be halfway thru I believe?

#

I dont know much atan2 either

pliant blade
#

@clever wing i think ur severely overcomplicating by using atan2 instead of dot?

clever wing
#

when I first tried dot vs atan2 as for calculation

#

creating a whole another vector and yap yap was extra

#
  • thought as more resource intensive
#

yeah u can do dot

clever wing
pliant blade
#

fair enough then

clever wing
#

u can go both ways

#

obviously

#

Im just teaching him what I did

#

dosnt mean he has to follow it step by step

clever wing
clever wing
#

typo

#

didnt fix it was copying from my TD's code

clever wing
#

and the final step

#

for you

#

is to raycast

#

I'll provide 2 instances

#

but I wont go over raycast

#

u got it

#

Instance 1

#

theres a wall infront of the player

#

Instance 2

#

theres a wall but opening

#

now you want to racyast

#

from the Bots Rootpart Position to the Characters position

#

and if theres any type of instance within, using RaycastFilter

#

you dont hit them

#

right and theres tons of tutorials about racyast and raycast filtering

clever wing
#

that the ai has found

clever wing
#

we went thru all the charaacters table

#

and then we filtered them out

#

@pliant bladedot would be easier

#

ur right

#

but yeah wtv wtv

pliant blade
#

yes

#

atan2 isint tooo much more complicated

clever wing
#

heres for that

#

you need to piece these codes together

#

and create your own snippet

#

right im js showing u the steps

#

after you raycast

#

and theres nothing between your ai and the character ur tryng to kill

#

your going to make the ai look at the character

#

you can lerp that, change cframe

clever wing
#

this script fulfills it

#

and on top

clever wing
#

well because u didnt spawn yet

#

you need to put this code in some type of detection loop

#

no because ur character takes time to load

#

it dosnt happen in 1 sec

#

and then shoot it

fluid spindle
clever wing
fluid spindle
#

i think i understand atan2 a bit now

clever wing
#

I dont

#

lol

#

I got repertor to do that equation for me

#

❤️

fluid spindle
clever wing
#

and if he did follow the steps

#

and ray casted

#

if there was something in his way there would be no highlight

clever wing
clever wing
#

Bored can u put ur code in here

#

so he can go thru it

fluid spindle
clever wing
#

u need to uh

fluid spindle
clever wing
#

learn more basics of scripting as well

fluid spindle
#

ummm i think forgot the raycast part

#

hold uppp

clever wing
#

before endevearing in these wild places

#

well

#

u dont

#

you cant really put together different snippets

#

right and my snippets had tables

#

they werent always full

#

but like obv u had to piece them together as well

#

das how u learn lowkey

#

just printing istn the basics

#

once u know how to put together you'll learn a lot

#

@void pendant

tall torrent
clever wing
#

cuz i love u so much

#

well first u need to know how they are used

#

raycast sends a 2d ray

#

thru a 3d world

#

and on the rendering level sees what it interacts with and sends that data back on roblox terms

#

exactly so you know

#

it can be used to see if there is a wall

#

between you and an enemy

#

then you dont know Raycast

#

yeah so now whenveer you need to check if theres something between you and another player

#

you fire a raycast

#

with the set properties

#

and see if there is

#

i js told u where to put it

#

and how to implement it

#

to check if there is something between you and your goal

#

there are many other ways it can be used too

#

learn more to debug and stuff

#

do simpler stuff until ur fluent or sum idk

#

idrk how i became good

#

@fluid spindle send the code

fluid spindle
#

oh yee

#

mbb

#

okk

clever wing
#

then you meet in the middle

#

go play roblox games

#

and see what seems easy

#

that you can replicater

#

try replicating

#

try making a pet system that follows you

fluid spindle
#

ima send it in pastebin hold up

clever wing
#

try making a movement system

#

where u sprint

#

yap yap

fluid spindle
#
local Player = game.Players.LocalPlayer
local Character = Player.Character

local Bots = game.Workspace:FindFirstChild("bots")

function  GetWithin()
    local withinradar = {}
    for _, bot in Bots:GetChildren() do
        if (bot.PrimaryPart.Position-Character.PrimaryPart.Position).Magnitude <= 20 then
            table.insert(withinradar, bot)
        end
    end
    return withinradar
end

function F()
    game.Workspace:FindFirstChild("highlights"):ClearAllChildren()
    local WithinRadar = GetWithin()
    
    local LookCFrame = Character.PrimaryPart.CFrame
    local Rx, Ry, Yz = LookCFrame:ToOrientation()
    local AttackingEnemies = {}

    for _, bot in WithinRadar do 
        local Delta = (bot.PrimaryPart.Position - Character.PrimaryPart.Position)
        local Angle = math.atan2(-Delta.X, -Delta.Z)
        local DiffAngle = (Angle - Ry) % (2 * math.pi)
        if DiffAngle > math.pi then
            DiffAngle = (math.pi * 2) - DiffAngle
        end

        if math.abs(DiffAngle) < math.rad(15) then
            local rayparams = RaycastParams.new()
            rayparams.FilterDescendantsInstances = {Character}
            rayparams.FilterType = Enum.RaycastFilterType.Exclude
            local ray = game.Workspace:Raycast(Character.PrimaryPart.Position, (bot.PrimaryPart.Position-Character.PrimaryPart.Position), rayparams)
            if ray then
                print(ray.Instance.Parent)
                if ray.Instance.Parent == bot then
                    table.insert(AttackingEnemies, bot)
                    local highlight = Instance.new("Highlight")
                    highlight.Parent = game.Workspace:FindFirstChild("highlights")
                    highlight.Adornee = bot
                end
            end
        end
    end
    print(AttackingEnemies)
end
clever wing
#

even with all my snippets NOT being nested

#

you had to nest it

fluid spindle
#

do i do it

#

rn

clever wing
#

i mean

#

its fine

#

it works

#

ig

clever wing
#

thats p much it

#

or he js clears higlight everytime

fluid spindle
clever wing
#

hey man a game like this would be fun

#

I want to make 1, 1 day

trail pivot
#

bro 300 comments gang 💀 🤣 crying @everyone

fluid spindle
#
local Player = game.Players.LocalPlayer
local Character = Player.Character

local Bots = game.Workspace:FindFirstChild("bots")

function  GetWithin()
    local withinradar = {}
    for _, bot in Bots:GetChildren() do
        if (bot.PrimaryPart.Position-Character.PrimaryPart.Position).Magnitude <= 20 then
            table.insert(withinradar, bot)
        end
    end
    return withinradar
end

function F()
    game.Workspace:FindFirstChild("highlights"):ClearAllChildren()
    local WithinRadar = GetWithin()
    
    local LookCFrame = Character.PrimaryPart.CFrame
    local Rx, Ry, Yz = LookCFrame:ToOrientation()
    local AttackingEnemies = {}

    for _, bot in WithinRadar do 
        local Delta = (bot.PrimaryPart.Position - Character.PrimaryPart.Position)
        local Angle = math.atan2(-Delta.X, -Delta.Z)
        local DiffAngle = (Angle - Ry) % (2 * math.pi)
        if DiffAngle > math.pi then
            DiffAngle = (math.pi * 2) - DiffAngle
        end

        if math.abs(DiffAngle) < math.rad(15) then
            local rayparams = RaycastParams.new()
            rayparams.FilterDescendantsInstances = {Character}
            rayparams.FilterType = Enum.RaycastFilterType.Exclude
            local ray = game.Workspace:Raycast(Character.PrimaryPart.Position, (bot.PrimaryPart.Position-Character.PrimaryPart.Position), rayparams)
            if ray then
                print(ray.Instance.Parent)
                if ray.Instance.Parent == bot then
                    table.insert(AttackingEnemies, bot)
                    local highlight = Instance.new("Highlight")
                    highlight.Parent = game.Workspace:FindFirstChild("highlights")
                    highlight.Adornee = bot
                end
            end
        end
    end
    print(AttackingEnemies)
end

game:GetService("RunService").Heartbeat:Connect(function()
    F()
end)
clever wing
#

its with three `

#

wouldnt work

#

render step is on client

#

u wantbot detection server side not client

fluid spindle
#

mb forgot to change

clever wing
#

do .Heartbeat

clever wing
fluid spindle
#

i was testing on local script sad

trail pivot
trail pivot
#

yee im tryna make a roblox version of astroneer and make it free and higher quality using editable images and mesh

#

boom 2d game

fluid spindle
#

yay

trail pivot
#

ok then use the roblox platformer game use the code from that game and put it into yours\

#

it has camera lock system

#

ez fix

fluid spindle
trail pivot
fluid spindle
trail pivot
#

leme find a vid for u

fluid spindle
#

im using this module that for r6 IK because i was a lil slow on figuring it myself but ummm im not sure how to do the stepping likeee im guessing it has to do with using sine waves

trail pivot
# fluid spindle foot planting ye

In this video you'll learn how to easily make procedural animations in Roblox using these 4 steps. I hope you enjoy the video!


RigEdit Lite:
https://create.roblox.com/store/asset/1274343708/RigEdit-Lite

My procedural animation module: https://create.roblox.com/store/asset/17842459894/Proce...

▶ Play video

Inverse kinematics is the mathematical process of calculating the variable joint parameters needed to place the end of a kinematic chain.

Become a member for great Channel and Discord perks!: https://www.youtube.com/channel/UCmIFjYx2aXrTjy5H8Zz1IfA/join
Discord Server: https://discord.gg/Fk8CF67RE7

If the invite doesn't work, try it from here:...

▶ Play video

Today i will show you how to make a basic footplanting code in roblox studio! The potential of inverse kinematics (IK) is insane and one of the many things you can do with it is procedural movment of your character. If you have problems with the code you can contact me in my discord server. (to make the legs move i used an open source module by ...

▶ Play video
fluid spindle
#

thankss

trail pivot
#

what about this one?

#

ye it has one just copy the cam system fro it @slender stump

trail pivot
normal magnet
#

vector:Dot() solos this thread