Jump to content

unknown reason for Failed to construct Vector3D object error [solved]


Recommended Posts

while working on patching Unit AI component for adding support for separating rider/horse entities. I found that when ordering a rider to hunt animals that are in FOW I always get the error Failed to construct Vector3D/Vector2D object. (although in the last patch the hunt and gather works well despite the error)

these two versions of code are usually source of error (line 2136 in the component):

let cmpTargetPosition = Engine.QueryInterface(this.order.data.target, IID_Position);
let pos = cmpTargetPosition.GetPosition();

and

let cmpTargetPosition = QueryMiragedInterface(this.order.data.target, IID_Position);
let pos = cmpTargetPosition.GetPosition();

both are throwing the same error but only the first one works perfectly despite the error.

  • Like 1
Link to comment
Share on other sites

On 11/11/2023 at 11:29 AM, man_s_our said:

after some debugging. I found out the thing that trigger this error is when the position is requested too many times in a moment. I don't know whether this is intended for security reasons or just a bug in the position component code.

Do you have steps to reproduce?

Link to comment
Share on other sites

21 hours ago, vladislavbelov said:

Do you have steps to reproduce?

it would be reproduced whenever is in infinite recursion. in my case infinite state switching. when I detected the bug I fixed it and now working on fixing other bugs.

the rest of the bugs left mostly related to not having proper states. one of them caused unit motion in fleeing state to not work properly as if the detected range was increased than real range. which cause the hunt target not fleeing if hunted by rider.

 

Link to comment
Share on other sites

4 hours ago, man_s_our said:

it would be reproduced whenever is in infinite recursion. in my case infinite state switching. when I detected the bug I fixed it and now working on fixing other bugs.

In that case the error might happen because of stack overflow/out of memory. If you replace it by a loop (with the same number of steps like for the recursion) in theory it shouldn't fail.

Link to comment
Share on other sites

  • man_s_our changed the title to unknown reason for Failed to construct Vector3D object error [solved]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...