#how do i detect what direction a player is swiping relative to them?

1 messages · Page 1 of 1 (latest)

sullen acorn
#

how would i?

fading dirge
sullen acorn
#

like hand velocity

#

like swiping a sword right

fading dirge
#

do you need the detect direction of the swipe?

sullen acorn
#

yeah

fading dirge
#

mb, didnt read post properly

sullen acorn
#

im trying to make the cursed technique "ratio" from jjk

#

if you know what that does

fading dirge
#

the one wher u hit at 3/7 of something, right?

sullen acorn
#

yeah

#

so the direction is kinda needed cuz your hitting across a imaginary line

fading dirge
#

not sure you even need to detect direction of swipe for that, just detect if the hit is near the part of length

sullen acorn
#

i want the line to be diffrent each time

fading dirge
#

it should be easy to just check the length of object for that

sullen acorn
#

its for a player and idk how to do that ):

fading dirge
#

that'll give you players height

#

then you just check if hit was at a specific distance relative to that height (so like the y level of collision should be (3*heigt)/7 if i remember the ability correctly)

sullen acorn
#

yeah...

#

would you be ever so kind and try make a image of what that would like

#

sorry if its too much trouble ):

fading dirge
# sullen acorn would you be ever so kind and try make a image of what that would like

when you spawn a player (make sure to run only for local player) > float variable (name it "player height)

to that variable you connect:
player get head position > vector3 split (use y output for next steps) > subtract (1st input)
local player > get position (will get position at players feet) > vector3 split (use y output for next step) > subtract (the earlier one, 2nd input)
connect the output of subtract to the variable

#

that'll give you the players height

#

you can use that for other stuff

sullen acorn
#

i have this

fading dirge
#

yep

#

now you just connect that variable to whatever you use to spawn player into the game

#

or you can connect it to "event receiver" (set event to Update30Hz)

#

that will check the height a lot of times per second keeping the height always somewhat accurate

sullen acorn
#

how to i now get the 3 / 7 part

fading dirge
sullen acorn
#

epic

fading dirge
#

or just multiply by 0,4285714285714 (aprox. 3/7th)

sullen acorn
#

crazy maths

fading dirge
#

calc

sullen acorn
#

ah

#

so thats epic i can detect if someone hits you in the 3 / 7 of your height

fading dirge
#

well you just have the y level of that 3/7th of height

sullen acorn
#

oh

fading dirge
#

to detect a hit, you just check if hit positions y level is close to that

sullen acorn
#

yeah

fading dirge
#

make sure to give some wiggle room for that cause its basically impossible to hit precisely at 3/7s even with hints

sullen acorn
#

in the show nanami's ratio isnt just from head to toe

#

it can be diagonal like this also

fading dirge
#

well, you could make it work on enemy's limbs but thats more difficult to implement (the hit part at least)

sullen acorn
#

yeah i dont really want to do that.

fading dirge
#

well, if you get players height only once, you could use that value for any rotation of player

#

but only situations when players are rotated diagonaly are when they're seated (f.e. when grabbed by other abilities)

sullen acorn
#

hmm

#

is there a way to randomize where the 3 / 7 ratio is?

fading dirge
#

if you're adding monsters, you just get the values once manually and clamp the ratio to stuff you want it to work

fading dirge
sullen acorn
#

like its more near the top or more near the bottom

#

idk how to explain stuff

fading dirge
#

well, you could just subtract 3/7 from the height to get 4/7 (aka 3/7 from top)

#

and you can do method i walked about earlier (multiply and divide) for bottom 3/7

sullen acorn
#

hmm

#

thats worth a shot

fading dirge
#

to randomize, you take two values, plug it into if value and then you just randomize the bool of that if value

sullen acorn
#

and what would that look like...

fading dirge
#

to randomize bool you just use random int (1st input is 0, 1nd input is 1) and check if that int is equal to 1

sullen acorn
#

cool

#

what values do i put into the if value

fading dirge
#

and connect red from "equals" to the red intput of if value

sullen acorn
#

i have this

#

here is closer

fading dirge
#

then to get y level of the required height, you take that value and add it to y level of local player

#

this

#

then, when you hit someone, check from that someones perspective (aka they have to be the local player in your calculations, basically same as when you check damage stuff in almost all pvp systems) you just check if collision hit positions y level is same as that

sullen acorn
#

this is making my brain hurt

fading dirge
#

welcome to cv2

sullen acorn
#

fair enough

#

would you be oh so epic and amazing to build this in my room for me before i explode.

fading dirge
#

nope

sullen acorn
#

poo

fading dirge
#

me no work for others

sullen acorn
#

we are already at 80+ messages sent ):

fading dirge
verbal hound
#

This channel is for teaching, learning, troubleshooting.

fading dirge
#

half people who want cv2 just get too tired too fast

sullen acorn
#

sorry chat

fading dirge
#

at least you're not like 30% of users here who just say "do this, ill pay you" in #1020094893458198578

sullen acorn
#

hell nah

#

i have been trying

verbal hound
#

I do get a bit quick to get antsy at it sorry

sullen acorn
#

all good

sullen acorn
# fading dirge dw

would it possible for you to build this in your room and send a pic so i can see where ive gone wrong because im kinda stuck.

#

are you fine with that?

fading dirge
sullen acorn
#

im so cooked

#

i may just wait till tommorow

fading dirge
sullen acorn
#

its also late for me anyways

fading dirge
#

just practice and make stuff and you'll get better

sullen acorn
#

ive been doing cv2 for 2+ years now

fading dirge
#

also, you probably dont have any deadline so dont stress it too much

sullen acorn
#

its just this i havent done much

#

but oh well ill go over the guide

fading dirge
#

tbh, it is just math and some small tricks

fading dirge
#

cv2 is just programming so you can use tricks from regular programming

sullen acorn
#

i feel like im being insulted ):

fading dirge
#

sorry

#

wasnt trying to

sullen acorn
#

its ok

#

final question

#

how would i turn the 3 / 7 into a vector3 position

fading dirge