#as in the direction to send bullet if
1 messages · Page 1 of 1 (latest)
I done messed up now ahaha. Im not really following how to do it. The way I tried to do it was
where moveInput is the "Horizontal" axis. Which you probably know is quite wrong
ok one sec
Vector3 aimDirection = destination - source
source is your player's position
destination is is the position of your aim gameobject
Okay and then use that instead of the vector2 part?
correct
you might just a Vector2 aimDirection
lemme know if you get it working or need more help
I'm trying to do it right now but I will if I mess it up ahaha. Thank you so much though:)
I've done Vector2 aimDirection = transform.position - player.position; and then transform.Translate(aimDirection * speed * Time.deltaTime);
does it work?
I can't drag and drop the player to the public Transform I've made though. I also tried with GameObject why is that? How else can I get the players position?
It's because I have a script for the bullet and one for the "weapon" and the script where this is in, the bullet script, is on a prefab which makes it so I can't drag the player I think
Oh will it still recognise the player in the scene then
Not sure, you may need to make a simple script that instantiates your player at a start position
try it out though before you do that
You can also find your player many other ways
through a Tag
no thats cool
ok can you show me bullet code and code where you instantiate
you are close
Woow I did it
THERE WE GO
Daamn that is soooo nice to have it working again
and i bet you learned some things along the way, you seem to have a grasp on the very basics
Thank you so much for your help my guy
You did most of it
good job
save
Direction = Destination - Source
Game dev uses it alot
actually here
i got a present for you
Yeah that was why it was frustrating because like Ik a little bit but not enough to like problemsolve ahaha
A present? you should be getting one
the Direction equation is top right
This is a cheat sheet i used to use, for common things, you can have it, add to it
Ahh nice cheat sheet thank you dude
yupp, good job, you CAN and do know how to problem solve
you did
did you make an extra aim gameObject on your player? One for each side
walk me through how you did it, it will solidify your knowledge (if you want)
No I actually went in to my movement script were I altered the way of flipping the character 2 hours ago. Before it rotated the players y by 180 degrees, which then made the bullets rotation also change to 180 degrees, because of my weapon script. But know it sets the scale to -1x, because it doesn't lag the character as much. But then of course the rotation didn't change, so I saved the shooting position into the movement script and rotated that by 180 degrees when ever the players scale was changed to -1x, and that ended up solving it. Don't know if it made sense and it wasn't even scripting that much ahahaha.
Thank you for your time and help:)
np