#FirepointIssue
1 messages · Page 1 of 1 (latest)
It does not work 😂
sprite just moves to coordinates instead
oh wait, thats old vide
What is Firepoint set to in the inspector?
No, what is firepoint property of PlayerController set to?
Ah, it's not serialized
firepoint = GetComponent<Transform>();
this
private Transform firepoint; and firepoint = GetComponent<Transform>(); in Update
What do you think that line does?
Finds ...... fire point object?
I used firepoint = GameObject.Find("FirePoint").transform; but its just freezes character in one place
freezes?🤨
the player just cant move at all if i use firepoint = GameObject.Find("FirePoint").transform;
shoul i make a [SerializiedField] and try dragging firepont into it?
That's not possible. At least not according to the code that you shared.
Yeah, that might work too.
ill send the video
i am pressing arrows, or a or d, but player does not move.
i will try serialized field now
it does not work
sad TT
Share your current code.
ok
here is my player controller
Are there any errors?
So if you comment out firepoint = GameObject.Find("FirePoint").transform;, does it fix your movement?
yes
but if i put firepoint = GetComponent<Transform>(); instead character goes to (-3.0.15f.0)
What if you comment out firepoint and all the code that uses it?
Then i can move and shoot snowballs to the right
but firepoint location does not flip with the character and snowball hits character when sprite is facing left
I use separate script for attack https://hastepaste.com/view/rZqQQ
and here is my snowball scripthttps://hastepaste.com/view/TwcX
ok
Sorry can’t take a screenshot since I am accessing desktop remotely, here’s a picture instead
I don't see the firepoint variable in the inspector. Did you comment it out?
currently yes
ok
Then add debugs in your movement logic.
Ok
if (WallJumpCoolDown > 0.2f)
{
player.velocity = new Vector2(horizontalInput * speed, player.velocity.y);
Debug.Log($"setting velocity to {player.velocity}");
if (isWall() && !isGrounded())
{
player.gravityScale = 2;
player.velocity = Vector2.zero;
Debug.Log($"resetting the velocity");
CreateDirt();
anim.SetTrigger("WallSlide");
}
else
player.gravityScale = 3;
if (Input.GetButtonDown("Jump"))
{
Jump();
CreateSnow();
jumpSE.Play();
}
}
ok i put that in
What do you see in your console when trying to move?
Take a screenshot of the console
hmmm, nothing but error pops up now NullReferenceException: Object reference not set to an instance of an object
PlayerController.Awake () (at Assets/Scripts/PlayerController.cs:37)
Share the updated script
ok
Btw this happens if I put get component <transformer> instead
updated code with debug
ufff
okay
The name here is wrong:
firepoint = GameObject.Find("FirePoint").transform;
It should be "Firepoint".
o,like in ispector?
lets see
OMG ITS WORKING NOW
I FEEL SO STUPID
THANK YOU SO MUCH
You were probably getting errors before(when your character didn't move). Always check your console for errors. Hiding the regular message logs can help you see the errors.