#Troubles with rotation

1 messages · Page 1 of 1 (latest)

worn bronze
#

so you mean that when you are trying to rotate its e.g. x axes - rotates smth another e.g. y or z ?

austere urchin
#
startDirection = Quaternion.Euler(
 ability.AngleOffset.x,
 ability.AngleOffset.y,
 ability.AngleOffset.z)
 * Vector3.forward;

 rotation = Quaternion.LookRotation(startDirection);```
#

Ok, so the idea is I have a character that shoots a projectile forward from their position

worn bronze
austere urchin
#

Do tell

#

I don't like rotations

worn bronze
#

you cannot change x directly, right?

austere urchin
#

no, I'm trying to rotate the x and z so the ability shoots out on an incline

#

changing the y will rotate it around the position

#

x/z will give some verticallity of the ability

worn bronze
#

y rotates it up and down, yes

#

x and z rotate it forward, backward, right and left

#

Also you have said that changing x position affetcs your y position

#

that cannot be

#

is it your issue?

austere urchin
#

changing the y does not get the direction any verticality

worn bronze
austere urchin
#

it rotates it around the y axis, with a vector3.up

#

using quaternion.lookrotation method

worn bronze
#

I don't get what's going wrong.

#

You cannot change its axes?

#

or do they change not like you want them to?

austere urchin
#

I have it changing, but depending on the forward direction of my transform, changing the x/z is not consistant

#

I can look one way, and it will cast downward, then changing my forward direction of my transform can make it cast upward with the same angle offset

#

some method of operations I'm missing here

worn bronze
#

what is ability ?

austere urchin
#

it's just a gameobject

worn bronze
#

ability must look player's rotation ?

#

no

#

I mean

#

player must look ability's rotation, right ?

#

but that doesn't make sense

austere urchin
#
startDirection = Quaternion.Euler(
 ability.AngleOffset.x,
 ability.AngleOffset.y,
 ability.AngleOffset.z)
 * transform.forward;```
#

er

austere urchin
#

ability is just data for the offset, the transform is the ability itself

worn bronze
#

that's so strange actually.

#

can you make a video or screenshot of your issue?

#

hold on

#

maybe you should apply rotation based on initial rotation?

worn bronze
#
// use initial transform.rotation
startDirection = transform.rotation * Quaternion.Euler(ability.AngleOffset) * Vector3.forward;

rotation = Quaternion.LookRotation(startDirection);
austere urchin
#

hmm

worn bronze
# austere urchin hmm

also I hope that you know that this is redundant

startDirection = Quaternion.Euler(
 ability.AngleOffset.x,
 ability.AngleOffset.y,
 ability.AngleOffset.z)
 * transform.forward;
austere urchin
#

ah, yeah I see what you mean

#

haha

worn bronze
#

just

startDireciton = Quaternion.Euler(ability.AngleOffset) * transform.forward;
austere urchin
#

I been fooling around a bit with it so I've had different variations

winter urchin
#

why need to rotate the projectiles tho?

worn bronze
worn bronze
austere urchin
#

ive a lot going on with the projecitles

worn bronze
#

yeah, that doesn't make sense for me.

winter urchin
#

why not just moveTwords

#

or how was the command called

#

if you can change it's forward

worn bronze
winter urchin
#

why need for rotation

worn bronze
winter urchin
#

oh so they want to literally rotate the projectile

worn bronze
winter urchin
#

rotate somewhere, then to go there

worn bronze
winter urchin
#

AA, how to explain, like homin in a way

#

change the course of the projectile

worn bronze
winter urchin
#

wherever u want ig

worn bronze
#

actually I also don't get what Mao is trying to do

#

and they also don't explain it properly

winter urchin
#

well, wouldn't a from start explanation

#

help

#

@austere urchin you can even draw if it's easier!

#

it helped me a lot in the past

worn bronze
austere urchin
#

hey, im still trying here lol

winter urchin
austere urchin
#

I sent some screenshots and thought it was pretty self explanatory

#

but I think the idea is the starting rotation of the object and the issue is I dont actually give it the rotation values until next frame (some init function)

winter urchin
#

so you want the rotation to corespond with where the charcahter is aiming in the Y axis?

worn bronze
winter urchin
worn bronze
winter urchin
#

@austere urchin if it what i am thinking set the position/forward of the spawn in the forward of the character you are willing to aim, like

#

you do not really have to work a lot with rotation on projectiles tbh

#

that's what i did and works perfectly

worn bronze
#

I also don't know what is ability and what is gameObject in their script

austere urchin
austere urchin
worn bronze
austere urchin
#

lol don't worry you gave me the idea I needed

#

ty for the help

worn bronze
#

I think you should learn how to explain your issues.

austere urchin
#

yeah, it's not easy to be that discrete without posting a huge chunk of code that this little tadbit represents

#

but the problem does revolve around the forward position of a transform and quaternion values not respecting it

worn bronze
#

if you had explained your issue a bit better, it should have been a easier for me to help you.

austere urchin
#

and it looks like it comes down to the original transform value rotation does not update as I want it on instantiation. It's some constraint class I'm using and it takes a frame to update the values

worn bronze
#

was is a question, or..?

austere urchin
#

no, I said I probably understand now, just waiting for compilement zzz

worn bronze
#

yeah, ok, I also don't think that I can help you more without understanding your issue.

austere urchin
#

yeah np ty though

austere urchin
#

yeah that was the problem. I needed the transform rotation as the FIRST value to multiply as well

worn bronze
austere urchin
#

and needed to get it the next frame because how I'm pooling it all

worn bronze
austere urchin
#

yep ;)

worn bronze
#

ok, I still don't know what you are doing, but I am glad you have fixed your issue

austere urchin
#

haha

#

ton of garbo

worn bronze
austere urchin
#

eventually