About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
[SOLVED] Question on object creation
Author Message
Pixel Perfect Offline
Member

Post: #1
[SOLVED] Question on object creation
I'm not entirely sure what's going on here. Are different conditions required depending on whether objCreate() or objCreateNear() are used?

The reason I ask is because if the following is placed at the start of the update loop then it works:

Code:
Game::ObjParamsPtr obj=Game::Objs.ptrRequire(UID(235184133, 1276344003, 2280509360, 3125416058));
obj->type(true,UID(3387464413, 1205019976, 2378094473, 973698012));
      
// Create new object at position and use objects default scaling
Game::World.objCreate(*obj, Matrix(obj->scale3(), Vec(-379.5, 4.0, 93.6)));

but this doesn't, the function returns a NULL obj pointer
Code:
Game::ObjParamsPtr obj=Game::Objs.ptrRequire(UID(235184133, 1276344003, 2280509360, 3125416058));
obj->type(true, UID(3387464413, 1205019976, 2378094473, 973698012));

// Create new object at position and use objects default scaling
Game::Obj* myObj = Game::World.objCreateNear(*obj, Matrix(obj->scale(), Vec(-379.5, 4.0, 93.6)));

However, introduce a slight delay and the second function works! What exactly is the objCreateNear() function intended for and why does it appear to take longer than objCreate to work after first entering the Update loop? What is its successful operation dependent on?
(This post was last modified: 08-20-2013 07:06 PM by Pixel Perfect.)
08-18-2013 07:51 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Question on object creation
Hi,

That's in the method comments:
Quote:method fails if 'matrix' is out of active range

Hope this helps!
08-20-2013 04:12 AM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #3
RE: [SOLVED] Question on object creation
Thanks, some more testing revealed I needed to place the call after the Game::World.update function smile
08-20-2013 07:07 PM
Find all posts by this user Quote this message in a reply
Post Reply