#How do I make a Trajectory Cast?

1 messages · Page 1 of 1 (latest)

fossil star
#

its big brain time

crude ravine
#

Do you mean a prediction of where movement will go?

fossil star
#

pretty much

#

but as a cast

crude ravine
#

Will the players see it? Or just as a raycast?

fossil star
#

just as a raycast

#

so its invisible

crude ravine
#

Ok. The way I would do it is by getting the velocity direction of the local player, then have a raycast chip start pos at the player, and direction of the velocity. If done right, it will make a straight line of where the player will go if they keep moving in that direction.

fossil star
#

yeah but thats not what im trying to do

#

raycast is a line

#

trajectory cast is curved

#

it uses a direction and gravity

crude ravine
fossil star
#

uh

#

1 sec

#

hmm

#

well

#

let me set an example for

#

lets say that i use a raycast, but its modified, so the direction would be (0, 0, 1,) also taking account of gravity, so it would curve down in the xyz vector

#

based on the value of the vector

#

it goes farther

crude ravine
#

I don't think that's possible. In RR, only straight lines of raycast can be done. You would need extremely complicated physics and ray cast systems for that to work.

fossil star
#

yeah

#

so thats im trying to do

#

complicated math and [hysics

#

physics

#

its possible

crude ravine
#

I could imagine it would be done with hundreds of tiny raycast chips.

fossil star
#

nah

#

its just some math and some other things

crude ravine
#

each going 0.01 meters, than doing physics stuff to calculate the next part

fossil star
#

you wouldn't need to use multiple raycasts

#

like i said, it uses complicated math

crude ravine
#

Well, curved raycasting isn't possible.

#

So trajectory cast, is also not possible.

fossil star
#

i didnt literally mean curve down

#

like it would still be a line, but taking account of gravity and pointing down

#

so its like a curve

#

but you dont see it curve

crude ravine
#

So it would point in the direction of where the player would land if they jump/fall?

fossil star
#

yeah

#

but im thinking i use objects

#

they are more smaller and easy to use

#

rather tha players

crude ravine
#

You could probably do what I said above with velocity, but do some math to take into account of how fast the player is falling to make it more accurate

fossil star
#

i tried getting an answer multiple times but i always got something i couldnt understand

dusty portal
#

U want to calculate where a projectile will land
Based on what?
Angle and velocity?

fossil star
#

yeah

#

initial velocity

crude ravine
#

Probably because Physics Math Circuits don't exist yet. So it can't calculate gravity or stuff like that.

fossil star
#

but you can

#

its just really complicated

crude ravine
#

That green line.

fossil star
#

yeah but that happens while in motion

#

I'm thinking as soon as you drop something like a ball it would then do the math and show the hit position

#

after its dropped

crude ravine
#

Yeah. I'm not sure if you can do that.

fossil star
#

bruh

#

you can\

#

theres videos about this stuff but its always in unity or something

#

so i would need some equations

#

to do the math easily

crude ravine
#

I mean with circuits.

fossil star
#

but you can bruh

crude ravine
#

I don't know if there are circuits to do that.

fossil star
#

its math

#

there is a lot of math chips u can use

#

for stuff like this

crude ravine
#

Then take what you see on unity, try and convert it into RR.

fossil star
#

ok bet

final lichen
#

What

fossil star
#

actually

#

the I think i can just subtract the y velocity by the gravitational pull of earth

#

9,8 squared

#

nvm

#

yeah hats the equation im using

#

im just figuring out how that works so i can make it in rr

#

so initial velocity, gravity, x and y components

#

should be simple

#

what are u typing bruh

#

the good thing about that equation is that it doesnt take account of air resistance

#

just like in rr

dusty portal
dusty portal
#

Everything I said are chips I'm rr

fossil star
#

thank you

#

you just saved like 3 hours of my life

fossil star
fossil star
#

little confused on what that adds up to

dusty portal
fossil star
#

oh thanks

fossil star
dusty portal
fossil star
#

alr thanks

late flame
#

@fossil star there is a much easier way to make a trajectory cast

fossil star
#

what is it

late flame
#

StartPosition + (StartDirection * (Velocity * Time)) for no-gravity

StartPosition + (StartDirection * (Velocity * Time)) + ((0,-1,0) * (4.805 * Time^2)) with gravity

fossil star
#

what is time

late flame
# fossil star what is time

StartPosition = Position the bullet was fired
StartDirection = Direction bullet was fired
Velocity = Speed of bullet in meters per second
Time = Time since fire

fossil star
#

it's not a gun

late flame
ocean drift
#

is time like a 0-1 thing where 0 is the initial raypoint and 1 is the hitpoint or?

fossil star
#

how do I get time since fire

#

float variable?

royal loom
#

When you fire store the current time get precise seconds as a float variable.

#

Then subtract the time get precise seconds from the time you stored to get the time since shot

late flame
ocean drift
#

ah i see, slightly different, never been the best with this type of math stuff lol

#

thanks for sending the equation :)

#

wait so in this case you'd have to keep checking for a hit while time increases right? what if the bullet goes at such a speed where between the ticks in 30hz it passes through a solid, it wouldn't detect any hit and keep going no?

#

assuming it's constantly being checked by a 30hz after fire

#

wouldn't you instead want to make a raycast between t && t+x

#

and check if that ray hit anything

fossil star
#

I'm confused cuz I never used time get precise second b4

ocean drift
#

when you fire the projectile you save universal time to some variable, then you subtract that time variable from universal time to get the time since fire

#

let's say the time of the universe started 10 seconds ago and we fire

#

you save 10

#

after 2 seconds the universal time is 12

#

so you get 12-10 == 2

#

time == 2

#

(i know you're not firing a projectile or whatever, just using it as example)

fossil star
#

ok

#

thanks

late flame
#

we need float precision

ocean drift
#

Right :0 mb

fossil star
dusty portal
fossil star
#

urs

#

yours*

#

I want to try both of them to see if one is better

dusty portal
fossil star
#

my user is @Sinning

fossil star
dusty portal
#

I can't get on but I'll send a picture

fossil star
#

ok thanks

#

u got it?

dusty portal
#

Vector create is the start position

#

And the tan and cos input is the angle

#

@fossil star

fossil star
#

ok

dusty portal
#

Vector get magnitude is for the velocity

fossil star
#

imma try this

#

but some of the circuits aren't wired? some values are 0

dusty portal
#

That's for u to input

#

Vector get magnitude is the velocity you input

fossil star
#

oh so the empty float values are for magnitude?

dusty portal
#

Cos and tan inputs are ur angle

#

The vector create is just ur start position

fossil star
dusty portal
fossil star
#

yeah I know

#

vector get magnitude is the velocity

#

I'm asking if the empty float values with 0 are for the velocity right?

dusty portal
fossil star
#

I'm confused

dusty portal
#

This is the angle

fossil star
#

so they just stay at 0?

dusty portal
#

That's the velocity

fossil star
#

ok

fossil star
#

it either goes to 0, 0, 0, or it goes somewhere in a wall

dusty portal
#

Ya bro try cryptics method its easier to make

#

It's 4:23 for me and I need to sleep

fossil star
#

ok

dusty portal
#

Send a picture of the circuits but I'll not reply until 10 hours later

#

✌️

dusty portal
fossil star
#

deleted the old one

#

having trouble multiplying and adding the vectors and velocity

dusty portal
#

Did u try cryptics?