Jump to content

[SOLVED] void Update Terrible bug in Unigine 2.11.0.1


photo

Recommended Posts

Hi Unigine Team,

I make a box , then I want the box follow me , but does not work , I think here is a terrible bug in Unigine 2.11.0.1 , Also I tested the Box Physics=rigid(Dynamic Mesh) & without Physics then UpdatePhysics/Update methods , but does not work , also I tested UpdateSyncThread & UpdateAsyncThread , result is same with terrible bug!

public vec3 p;

 

Code 01 (Once Run in Update Method!)

void Update()
{        // write here code to be called before updating each render frame
        p=node.FindNode("first_person_controller").Position;
        World.GetNodeByName("box1").Position=p;
}


Code 02 (The rotation continues and runs frame by frame!)

void Update()
{     // write here code to be called before updating each render frame
      World.GetNodeByName("box1").Rotate(Game.IFps*100,0,0);
}


 NOW , Why for code 01 is once run?! but for code 02 is running without problem (rotating) ?

+ There is also a problem with the spoiler!

image.png

Link to comment

Hi Ahmad,

May I ask you to use <code> tag to format source code? Here it is: image.png

About your current issue, it's hard to tell what is going on. Have you tried to check if your p=node.FindNode("first_person_controller").Position is valid? Maybe here there is a null pointer exception? Why not use the same GetNodeByName() for that?

 

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
3 hours ago, silent said:

Hi Ahmad,

May I ask you to use <code> tag to format source code? Here it is: image.png

About your current issue, it's hard to tell what is going on. Have you tried to check if your p=node.FindNode("first_person_controller").Position is valid? Maybe here there is a null pointer exception? Why not use the same GetNodeByName() for that?

 

 

also this three line code, compiled success , also make a same error in runtime...in update method...

p=node.FindNode("first_person_controller").Position;
World.GetNodeByName("box1").Position=p;
Unigine.Console.Run(p.ToString());

 

image.thumb.png.bd41a12064055835a904969a9442e78d.png

 

Yes I used  GetNodeByName Mr @silent but only ONCE RUN...

I tested codes bellow , compiled success , but once run in update method...

code01

p=World.GetNodeByName("first_person_controller").Position;
World.GetNodeByName("box1").Position=p;
Unigine.Console.Run(p.ToString());

 

code02

World.GetNodeByName("box1").Position= World.GetNodeByName("first_person_controller").Position;
Unigine.Console.Run(p.ToString());

 

code03

World.GetNodeByName("box1").Position= new vec3(World.GetNodeByName("first_person_controller").Position);
Unigine.Console.Run(p.ToString());

image.thumb.png.fcfc4af41d15ef6f8c0aac31a2e6669c.png

 

of course code 02 and code 03 is p= (0,0,0) 

 

 

Edited by ahmad.karami
Link to comment

From the attached screens I can see that code executes multiple times (not a single one as you mentioned). Also, instead of Unigine.Console.Run(p.ToString()); use Unigine.Log.Message($"{p.Tostring()}\n");

If you still want to create some kind of the player persecutor behavior you can use attached component. Just drop it to the box and specify the player to follow.

Thanks!

Persecutor.cs

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
13 minutes ago, silent said:

From the attached screens I can see that code executes multiple times (not a single one as you mentioned). Also, instead of Unigine.Console.Run(p.ToString()); use Unigine.Log.Message($"{p.Tostring()}\n");

If you still want to create some kind of the player persecutor behavior you can use attached component. Just drop it to the box and specify the player to follow.

Thanks!

Persecutor.cs 613 B · 1 download

Thank you Mr @silent I have very bad news , I implemented/tested your csharp code file , Only Once Run , then box do not follow me !!! may be this code file relegated to other version Enterprise & Sim ... but for free version does not work , also this Unigine.Log.Message($"{p.Tostring()}\n"); line , I tested but show error in compile !! 

I attached my c# file , please see , also disable Unigine.Log.Message for compiled success :-(

image.thumb.png.57c4266ddf0c36a2a86b82ec70259dc0.png

image.thumb.png.66ae2dc7f5b573f588e4fdc65088b358.png

BoxFollowMe.cs

Link to comment

Plus , I have +5 years experience C++ & C# (Medium) and Other languages like Text/Graph , this is my account in youtube 

https://www.youtube.com/channel/UCN9MWr1LFeR7i5AdkyxVMbg/playlists 

I wrote C++/tools book for CryEngine 5.x (634 golden pages)

http://www.mediafire.com/file/6to3x5aj2ajykdw/CryEngine_5_Book-Persian_Language-Ahmad_Karami.pdf/file

Trust me and I have enough experience, I don't mean advertising for myself.

 

I think there are a lot of bugs that need to be fixed ... at least C# API for unigine ...
 
Thanks a lot 
Edited by ahmad.karami
Link to comment

Hi Ahmad,

I've played a little with your component and I think I found what is going on. The first_person_controller.node being placed as NodeReference returns null when I try to get it. I've solved it by placing this node as Node contents:
image.png

After that I've replaced Target to follow in BoxFollowMe.cs to a new node:

image.png

And it looks like everything is fine right now and box is following player as it should.


We will try to find out why NodeReference object didn't work at the first place. Thank you for finding this!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
1 hour ago, ahmad.karami said:

 Unigine.Log.Message($"{p.Tostring()}\n"); line , I tested but show error in compile !! 

 

 

Well - I think that was a minor typo (it happens ;) )

BUT: p.ToString() was working, was it not?

When you changed to p.Tostring() it stopped?

So try capitalizing the 'S' in String -> Tostring() => ToString()

Link to comment
3 hours ago, silent said:

Hi Ahmad,

I've played a little with your component and I think I found what is going on. The first_person_controller.node being placed as NodeReference returns null when I try to get it. I've solved it by placing this node as Node contents:
image.png

After that I've replaced Target to follow in BoxFollowMe.cs to a new node:

image.png

And it looks like everything is fine right now and box is following player as it should.


We will try to find out why NodeReference object didn't work at the first place. Thank you for finding this!

Hi Mr @silent , You're welcome ;-) , I tested top code with content node not reference node,  box follow me now , Thank you  :-)

 

Edited by ahmad.karami
Link to comment
3 hours ago, mark.pizzolatto said:

Well - I think that was a minor typo (it happens ;) )

BUT: p.ToString() was working, was it not?

When you changed to p.Tostring() it stopped?

So try capitalizing the 'S' in String -> Tostring() => ToString()

Hi @mark.pizzolatto , I know , thank you for your suggestion , I already tested , does work ;-)

Edited by ahmad.karami
Link to comment
6 hours ago, ahmad.karami said:

 

also this three line code, compiled success , also make a same error in runtime...in update method...


p=node.FindNode("first_person_controller").Position;
World.GetNodeByName("box1").Position=p;
Unigine.Console.Run(p.ToString());

 

image.thumb.png.bd41a12064055835a904969a9442e78d.png

 

Yes I used  GetNodeByName Mr @silent but only ONCE RUN...

I tested codes bellow , compiled success , but once run in update method...

code01


p=World.GetNodeByName("first_person_controller").Position;
World.GetNodeByName("box1").Position=p;
Unigine.Console.Run(p.ToString());

 

code02


World.GetNodeByName("box1").Position= World.GetNodeByName("first_person_controller").Position;
Unigine.Console.Run(p.ToString());

 

code03


World.GetNodeByName("box1").Position= new vec3(World.GetNodeByName("first_person_controller").Position);
Unigine.Console.Run(p.ToString());

image.thumb.png.fcfc4af41d15ef6f8c0aac31a2e6669c.png

 

of course code 02 and code 03 is p= (0,0,0) 

 

 

I tested a file top  , does work ;-) if you want , you can see my code, I attached here  , box follow me (player) , with content node not reference node  , GREAT...

I continue for Discover the world of C# API Unigine ;-)

TestCSharpCode.cs

Link to comment

Thank you Mr @silent  You SOLVED ... the c# file code attached ;-) with content node not reference node :-)

plus , Box follow me(player) & box look at player :-)  and show message ...

image.thumb.png.db4172c939cf4c09fdd0f94aab549b0e.png

BoxFollowMe.cs

Edited by ahmad.karami
Link to comment
  • silent changed the title to [SOLVED] void Update Terrible bug in Unigine 2.11.0.1
×
×
  • Create New...