[Solved]x,y,z properties of Ogre.Vector3 is missing Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
niubaty
Kobold
Posts: 27
Joined: Thu Jan 10, 2019 2:19 pm
x 1

[Solved]x,y,z properties of Ogre.Vector3 is missing

Post by niubaty » Wed Jan 23, 2019 2:39 am

Ogre Version: master
Operating System: win10
Render System: GL3+

Code: Select all

>>> dir(Ogre.Vector3(1,1,1))
['__add__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__int__', '__isub__', '__itruediv__', '__le__', '__lt__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', 'acquire', 'angleBetween', 'append', 'disown', 'distance', 'dotProduct', 'isNaN', 'isZeroLength', 'length', 'makeCeil', 'makeFloor', 'next', 'normalise', 'normalisedCopy', 'own', 'positionEquals', 'reflect', 'squaredDistance', 'squaredLength', 'this', 'thisown', 'xy']
The x,y,z static const Vector3 UNIT_X and other properties of Ogre.Vector3 is missing, the OgreVector3.h is very different from the version of 1.10. I don't know how to make it work.
Last edited by niubaty on Sun Feb 17, 2019 11:44 am, edited 1 time in total.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 749
Joined: Sun Mar 30, 2014 2:51 pm
x 116
Contact:

Re: x,y,z properties of Ogre.Vector3 is missing

Post by paroj » Wed Jan 23, 2019 11:48 am

Code: Select all

>>> Ogre.Vector3(2)[1]
2.0
0 x

niubaty
Kobold
Posts: 27
Joined: Thu Jan 10, 2019 2:19 pm
x 1

Re: x,y,z properties of Ogre.Vector3 is missing

Post by niubaty » Wed Jan 23, 2019 1:33 pm

paroj wrote:
Wed Jan 23, 2019 11:48 am

Code: Select all

>>> Ogre.Vector3(2)[1]
2.0

Code: Select all

>>> import Ogre
>>> v=Ogre.Vector3(1,2,3)
>>> v[1]
2.0
>>> v[1]=3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'Ogre.Ogre.Vector3' object does not support item assignment
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 749
Joined: Sun Mar 30, 2014 2:51 pm
x 116
Contact:

Re: x,y,z properties of Ogre.Vector3 is missing

Post by paroj » Wed Jan 23, 2019 2:10 pm

the main purpose of the math types in the bindings is to allow calling functions taking the respective type. While you can use it for math computations they will slow due to the python>C++>python roundtrips.

If you want to make it work nevertheless start here:
https://github.com/OGRECave/ogre/blob/m ... gre.i#L175

probably you will need to change the bindings like that:
https://github.com/swig/swig/blob/maste ... oad.i#L210
0 x

niubaty
Kobold
Posts: 27
Joined: Thu Jan 10, 2019 2:19 pm
x 1

Re: x,y,z properties of Ogre.Vector3 is missing

Post by niubaty » Thu Jan 24, 2019 6:58 am

1.What's the correct python way if I want to increase a vector3 in every frame?

In older version(1.10):

Code: Select all

v.x+=1
Is there any more efficient way than below:

Code: Select all

v+=Ogre.Vector3(1,0,0)

2.some function of vector3 is missing too (getRotationTo)

Code: Select all

Traceback (most recent call last):
  File "character_sample.py", line 682, in <module>
    app.getRoot().startRendering()
  File "character_sample.py", line 385, in frameRenderingQueued
    self.char.addTime(fe.timeSinceLastFrame)
  File "character_sample.py", line 134, in addTime
    self.updateBody(dt)
  File "character_sample.py", line 146, in updateBody
    togoal=self.bodynode.getOrientation().zAxis().getRotationTo(self.goaldirection)
AttributeError: 'Ogre.Ogre.Vector3' object has no attribute 'getRotationTo'
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 749
Joined: Sun Mar 30, 2014 2:51 pm
x 116
Contact:

Re: x,y,z properties of Ogre.Vector3 is missing

Post by paroj » Wed Jan 30, 2019 6:58 pm

0 x

niubaty
Kobold
Posts: 27
Joined: Thu Jan 10, 2019 2:19 pm
x 1

Re: x,y,z properties of Ogre.Vector3 is missing

Post by niubaty » Sun Feb 17, 2019 11:43 am

paroj wrote:
Wed Jan 30, 2019 6:58 pm
fixed in https://github.com/OGRECave/ogre/pull/1074
Thank you
0 x

Post Reply