Strange bug....

ok, so nowhere in any of these scripts to I touch own.localScale etc.

the objects that are following are following via python,

each object is scaling smaller the next…

like this http://en.wikipedia.org/wiki/Golden_spiral

Attachments

Crawler2.blend (485 KB)

You’re scaling the objects’ orientation matrices. I’m not quite sure what you’re trying to accomplish with this line.

own.worldOrientation = ((own.worldOrientation*127)+Trot.worldOrientation)*0.0078125

Generally you should only rotate orientation matrices and avoid doing basic operations on them like addition and multiplication.

If you want a quick fix, you can just add

own.worldOrientation.normalize()

after that line. However, If you’re just trying to get the objects to face the direction they’re moving, I would recommend getting rid of that line doing something like this.

own.alignAxisToVect(own.worldLinearVelocity, 1)

The scale transformation involves the diagonal of the matrix ([0,0], [1,1],[2,2]).

Edit: this belongs to the orientation transformation, which must be multiplied with the current transformation matrix. I’m not sure if the result is a scale on each single component. It might be.

I was trying to add up and then get a average of matrices, however I think It my be wise to change the orientation into vectors first,

desired=(((own.worldOrientation.col[2]*127)+target.worldOrientation.col[2])\128)

however I have not tested it yet.

ok,


import bge
from mathutils import Vector
cont=bge.logic.getCurrentController()


own=cont.owner
scene= bge.logic.getCurrentScene()
Trot = scene.objects[own['target']]
offset= Vector([0,-1,1.5])
offset= Trot.worldPosition +(Trot.worldOrientation*offset)
targetRot= ((own.worldOrientation.col[2]*127)+Trot.worldOrientation.col[2])*0.0078125
own.alignAxisToVect(targetRot,2,1)
own.worldPosition = ((own.worldPosition*127)+offset)*0.0078125

works just fine,