#frdy 1508https hastebin skyra pw
1 messages · Page 1 of 1 (latest)
I have some videos
is that purple bar supposed to be on the tank?
no
I guess it's arbitrary
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
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?
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 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?
what am I missing?
I don't think you are missing anything
I want it to lock in place when the mouse moves to the top or bottom so it doesn't move after that
But I think this is better anyway so I am going with this
I also hate this
the snapping
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)
I was also thinking to just apply the angle to the projectile when it spawns
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
I am working on 4 hours of sleep
my mind has reached it's limmits
it's been like 16 hours
..... are you in a jam or something?
that'll burn you out quick
that was the first time I opened this in 1 month
which is actally pretty good for me
relatable
mostly cause of school
anyway, try what I suggested
I spent 5 mins looking at it
And not getting it
And also using ChatGPT
No I don't know how to
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)
well it got мe some of the original code
and that's probably why you'll get stuck again in the future
chatgpt won't teach you anything
ANYWAY
nah it has
I made a whole website that is better than like all of my peers with minimal prior understanding of css and java
we're getting off topic
and like 4 css stylus scripts that people have downloaded for different websites
ya
I once got stuck for 5 hours cause I hit freeze position on a rigidboddy and it took me and 4 other people to notice it
I've got to go. I've given you enough breadcrumbs to solve it yourself. read the documentation.
.
alright
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.
K this doesn't work
It doesn't allow it to go down
debug.log the angle in each case (point up and face left, face right, point down, etc) and show it
going down = going up
But going up wins
debug.log everything. the tank's forward vector, the direction to the mouse pointer...
you used SignedAngle?
what's lookangle?
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
did you read what I sent? Vector2.SignedAngle will return negative values
Vector2.Angle will not
as for that newer problem.... I don't know know what's going on
I though you wanted me to use Vector2.Angle
The newer problem is just something with debug.log
.
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
I have gotten to this point where
- Yes the angles flip but they also desync with the cursor
- Still shoots backwards (I have an idea)
- You have to first move left to be able to aim
OK fixed 2
Have any ideas for 1 and 3?
@stiff rain are you multiplying an angle in degrees by Rad2Deg?
radtodeg =180/pi iirc. a relatively large value
no
whole code:
https://hastebin.skyra.pw/vewecefafo.pgsql
I have a feeling that the mouse position won't register until the window's been focused on (clicked), but I might be wrong
No literally click it in the video
But it doesn't update the mouse position till I turn left
Man rambles with 4h of sleep
yea ChatGPT said Definitely direct quote "Bruh just rotate it very sligthy"
k so only Dsync when left travling left