#frdy 1508https hastebin skyra pw

1 messages · Page 1 of 1 (latest)

quaint drift
#

@stiff rainwhat is the unwanted behavior?

stiff rain
quaint drift
#

is that purple bar supposed to be on the tank?

stiff rain
#

no

quaint drift
#

I guess it's arbitrary

stiff rain
#

the purple bar is a placeholder for a cool angle thing
I don't thing there is anywhere I can put it on the small tank

quaint drift
#

It's hard to tell from the videos where exactly in 3d space that gun is. the second video seems to be finding the angle between the tank and mouse position, and I assume you want the purple thing itself to point at the mouse?

stiff rain
#

not the purple thing

#

the purple thing is a visualization

quaint drift
#

oh man I just realized from one of the videos

#

you're trying to manually account for the fact that atan2 returns (in degrees) -180 to 180

stiff rain
#

yes it does

quaint drift
#

@stiff rainI'm still unclear on what exactly you're trying to do.
Do you want it so that, for example:
when the tank faces to the left and the mouse pointer is to its right, it points like this?

stiff rain
#

yes

#

kind off

quaint drift
#

what am I missing?

stiff rain
#

I don't think you are missing anything

quaint drift
stiff rain
#

the snapping

quaint drift
#

I think that vector2.angle is the better way of doing this. for the first parameter, you'd just want the horizontal direction of the tank, so that when:
it's facing left, it'll return: (-1,0)
it's facing right, it'll return: (1,0)

stiff rain
#

I was also thinking to just apply the angle to the projectile when it spawns

quaint drift
#

the second parameter will just be the vector from somewhere near the center of the tank to the mouse pointer

#

then you clamp the turret angle to something like 30 degrees or so

#

this all prevents any need for you to mess with the c# trig functions

stiff rain
#

I am working on 4 hours of sleep

#

my mind has reached it's limmits

#

it's been like 16 hours

quaint drift
#

..... are you in a jam or something?

stiff rain
#

no

#

I just spent 4 hours last night trying to do this destroying my sleep

quaint drift
#

that'll burn you out quick

stiff rain
#

which is actally pretty good for me

quaint drift
#

relatable

stiff rain
#

mostly cause of school

quaint drift
#

anyway, try what I suggested

stiff rain
#

I spent 5 mins looking at it
And not getting it
And also using ChatGPT
No I don't know how to

quaint drift
#

chat gpt doesn't really help you lol

#

@stiff raintry debug.logging your root gameobject's transform.forward

#

it should return a vector that's (1,0) or (-1,0)

stiff rain
#

well it got мe some of the original code

quaint drift
#

and that's probably why you'll get stuck again in the future

#

chatgpt won't teach you anything

#

ANYWAY

stiff rain
quaint drift
#

we're getting off topic

stiff rain
#

and like 4 css stylus scripts that people have downloaded for different websites

stiff rain
stiff rain
quaint drift
#

I've got to go. I've given you enough breadcrumbs to solve it yourself. read the documentation.

stiff rain
#

alright

quaint drift
#

using vector2.angle(tank.transform.forward, mouse.position-tank.position) will give you an always-positive angle value I believe

#

actually check this out

#

the docs themselves give a solution

#

cya. good luck.

stiff rain
#

alright

#

ok this has been more unhelpful than chatgpt...

stiff rain
quaint drift
stiff rain
#

going down = going up
But going up wins

quaint drift
#

debug.log everything. the tank's forward vector, the direction to the mouse pointer...

#

you used SignedAngle?

stiff rain
#

this is just lookAngle

quaint drift
#

what's lookangle?

stiff rain
#

float lookAngle = Vector2.Angle(tankDirection, mousePosition - tankPosition);

#

k for some reason player(tank).transform.forward (tankDirection) is showing up as 0.0, 0.0 no matter what I do
It wasn't doing this before

quaint drift
#

Vector2.Angle will not

#

as for that newer problem.... I don't know know what's going on

stiff rain
#

I though you wanted me to use Vector2.Angle

#

The newer problem is just something with debug.log

quaint drift
stiff rain
#

Even chatGPT yelled at me to use Signed Angle

#

Still I am using some of my previous code
Which I stole from a youtube video

stiff rain
#

I have gotten to this point where

  1. Yes the angles flip but they also desync with the cursor
  2. Still shoots backwards (I have an idea)
  3. You have to first move left to be able to aim
#

OK fixed 2

stiff rain
quaint drift
#

@stiff rain are you multiplying an angle in degrees by Rad2Deg?

#

radtodeg =180/pi iirc. a relatively large value

quaint drift
#

I have a feeling that the mouse position won't register until the window's been focused on (clicked), but I might be wrong

stiff rain
#

yea ChatGPT said Definitely direct quote "Bruh just rotate it very sligthy"

#

k so only Dsync when left travling left