Commit
…s which allows place gameobjects cornerwise. Update '.gobject turn' command, now you have to specify 3 rotations to turn gameobject: rotation angles around z, y and x axes. Note to DB devs: use QuaternionCompressed::Unpack to extract rotations from the data that came with UPDATEFLAG_ROTATION.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ALTER TABLE db_version CHANGE COLUMN required_11523_02_mangos_mangos_string required_11529_01_mangos_command bit; | ||
|
||
DELETE FROM command WHERE name = 'gobject turn'; | ||
|
||
INSERT INTO command (name, security, help) VALUES | ||
('gobject turn',2,'Syntax: .gobject turn #goguid [#z_angle]\r\n\r\nChanges gameobject #goguid orientation (rotates gameobject around z axis). Optional parameters are (#y_angle,#x_angle) values that represents rotation angles around y and x axes.'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#ifndef __REVISION_NR_H__ | ||
#define __REVISION_NR_H__ | ||
#define REVISION_NR "11528" | ||
#define REVISION_NR "11529" | ||
#endif // __REVISION_NR_H__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#ifndef __REVISION_SQL_H__ | ||
#define __REVISION_SQL_H__ | ||
#define REVISION_DB_CHARACTERS "required_11436_01_characters_character_queststatus" | ||
#define REVISION_DB_MANGOS "required_11523_02_mangos_mangos_string" | ||
#define REVISION_DB_MANGOS "required_11529_01_mangos_command" | ||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" | ||
#endif // __REVISION_SQL_H__ |
21 comments
on commit 2bcbc0f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for asking, but is there any possibility to replace UpdateRotationFields
function with new functions?
e.g. for SotA patch this code is used in scripts:
GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f);
GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f);
maybe move SetRotationQuat
function to public and replace with:
GetBGObject(BG_SA_BOAT_ONE)->SetRotationQuat(0.0f, 0.0f, 1.0f, 0.0002f);
GetBGObject(BG_SA_BOAT_TWO)->SetRotationQuat(0.0f, 0.0f, 1.0f, 0.00001f);
I know you do not support or maintainance custom patches, but still I would be happy if you can help :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SetRotationAngles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to use them here :/
in UpdateRotationFields
function rotation2 and rotation3 are used:
GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f); // rotation2, rotation3
in SetRotationAngles
function there are z_rot, y_rot and x_rot and I don't know the equivalent parameter :/
z_rot is rotation2? if yes, what is rotation3 and how can I use this param with SetRotationAngles
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also you may put these parameters into Gameobject::Create as rotation0, rotation1 etc
z_rot is rotation2?
// z_rot, y_rot, x_rot - rotation angles around z, y and x axes
void SetRotationAngles(float z_rot, float y_rot, float x_rot);
'z_rot' can be called 'orientation'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, so as one solution it is possible to add special exceptions for gameobject ids in Gameobject::Create
, like this?
if (exceptions...)
SetRotationQuat(rotation0,rotation1,1.0f,0.0002f);
else
SetRotationQuat(rotation0,rotation1,rotation2,rotation3);
but I still do not understand how I can convert rotation2 and rotation3 parameters into SetRotationAngles
function :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably
GetBGObject(BG_SA_BOAT_ONE)->SetRotationAngles(acosf(0.0002f), 0.0f, 0.0f);
GetBGObject(BG_SA_BOAT_TWO)->SetRotationAngles(acosf(0.00001f), 0.0f, 0.0f);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you very much :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, not SetRotationAngles(2_acosf(0.0002f), 0, 0) and SetRotationAngles(2_acosf(0.0001f), 0, 0) ?
In case your gameobjects listed in 'gameobjects' table you may just modify their rotation0 .. rotation3 fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, big thanks to both of you :) I adopted that :)
but these gameobjects are spawned by script and unfortunately not in database :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry to bother you again, but this does not work correctly :(
would this work as a hack in GameObject::Create
to fix it for first time?
if (entry ID exception)
SetRotationQuat(rotation0,rotation1,1.0f,0.0002f);
else
SetRotationQuat(rotation0,rotation1,rotation2,rotation3);
PS: Solved! I set rotation2 and rotation3 in BattleGround::AddObject
function :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SilverIce:
still does not work, even if I set correct rotation2 and rotation3 :( maybe something in calculation has changed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you will remove this:
GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f);
GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f)
or use:
SetRotationQuat(GetOrientation(),0,0)
SetRotationQuat(GetOrientation(),0,0)
what happens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we remove this the boat moves into opposite direction then :(
it seems that orientation is ignored, because if you change orientation in script, boat spawns are always the same
where should I use this?
SetRotationQuat(GetOrientation(),0,0)
and isn't it already removed?
UpdateRotationFields(GetOrientation(),0,0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where should I use this?
if (GameObject * obj = GetBGObject(BG_SA_BOAT_TWO))
obj->SetRotationQuat(obj->GetOrientation(),0,0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used
if (GameObject * obj = GetBGObject(BG_SA_BOAT_TWO))
obj->SetRotationQuat(obj->GetOrientation(),0,0,0) // 4 parameters
and again boat moves into opposite direction then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after this fix
http://s43.radikal.ru/i102/1105/fc/a97b9592f709.jpg
http://i066.radikal.ru/1105/29/c522fd300441.jpg
UDB base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirm. after this gameobjects seem to ignore orientation sometimes :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My code works correctly (Example: .go object 60314)
Ofc gameobject will be placed wrong in case there is some shit in DB
set gameobject rotation2 and rotation3 fields to zero and you will see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you set rotation2 and rotation3 fields to zero they are spawned correctly yes, BUT then rotation is incorrect :(
e.g. SotA boats (move into opposite direction)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming orientation has correct value this can be used as temporary solution (will replace both crap and good data)
UPDATE gameobject SET rotation0 = 0, rotation1 = 0, rotation2 = SIN(orientation * 0.5), rotation3 = COS(orientation * 0.5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, sorry for asking, but I do not understand how this should help :/
if you see in case of SotA boats, the rotation is correct, because the boat moves to correct position with correct angle. only thing that is bugged is orientation.
besides: this does not have any effect on gameobjects spawned by scripts or core :(
Shouldn't quaternion be normalized?