DoorClass advanceThreads not called

Expanding and utilizing the engine via C++.
9 posts Page 1 of 1
Posts: 183
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Wed Jan 13, 2016 10:49 am
I gave a try to the free DoorClass from and I couldn't get it to work. I tried to debug it and I notice that the Door::advanceThreads(F32 dt) function is not called and it contain important code to deal with the opened/closed state. I tried different things but got no success to get the advanceThreads call. I have been able to make it work by using the onSequenceEnd callback and hidding the ColMeshes with the script but I'd prefer to use the code..

Anyone have an idea about what's is happening? Something have changed in this area recently?

The parent ShapeBase::advanceThreads(F32 dt) get called, shouldn't the Door function be called before since it's a child? The function is public and from previous experience, it should be called...right? :oops: I think the code setup is made so that only the Door::advanceThreads(F32 dt) get called, what you think is missing?

You can grab the DoorClass files from there:
Posts: 32
Joined: Tue Feb 10, 2015 10:23 pm
by RichardM » Thu Jan 28, 2016 11:29 pm
Sorry for the late response, but I was occupied with other things. I will take a look at it.
Posts: 55
Joined: Tue Apr 14, 2015 5:02 am
by SqHd » Fri Jan 29, 2016 10:48 pm
Great! It would be awesome having this in the current version! Thanks!
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
by paulmm123 » Sat Feb 13, 2016 12:29 am
Add it to door class on file doors.cpp:

void Door::advanceTime(F32 dt)

Now will be called, but still not working...

after advanceTime change, isGhost() ways true and mShapeInstance->getTriggerState not get some index...
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
by paulmm123 » Tue Feb 16, 2016 6:55 am
I'm not sure, there is a small bug in Door::packUpdate and Door::unpackUpdate that dont update door property islocked on editor
The commented lines make work...
U32 Door::packUpdate(NetConnection *connection, U32 mask, BitStream *stream)
	Con::errorf(ConsoleLogEntry::General, "Door::packUpdate");
	U32 retMask = Parent::packUpdate(connection, mask, stream);

	//if (stream->writeFlag(mask & OpenMask))<--------if enabled, dont update door property islocked on editor 
	//if (stream->writeFlag(mask & LockMask))<--------if enabled, dont update door property islocked on editor 

	if (stream->writeFlag(key))
		stream->writeRangedU32(key->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
// of code
why only stream->writeFlag(mask & LockMask) dont work however only stream->writeFlag(mIsLocked); work ? :?:

void Door::unpackUpdate(NetConnection *connection, BitStream *stream)
	Con::errorf(ConsoleLogEntry::General, "Door::unpackUpdate");
	Parent::unpackUpdate(connection, stream);
	mBlockCheckEnable = stream->readFlag();
	Con::errorf(ConsoleLogEntry::General, "mBlockCheckEnable %d",mBlockCheckEnable);
	//if (stream->readFlag())   <-------if enabled, dont update door property islocked on editor 
		mIsOpen = stream->readFlag();
		Con::errorf(ConsoleLogEntry::General, "mIsOpen %d",mIsOpen);
	//if (stream->readFlag()) <--------if enabled, dont update door property islocked on editor 
		mIsLocked = stream->readFlag();
		Con::errorf(ConsoleLogEntry::General, "mIsLocked %d",mIsLocked);
// of code

if I am not mistaken, both BitStream::writeFlag() and BitStream::readFlag() foward the bit mask from bitNum , if i call two times subsequently I would not take the wrong bit ?

Thanks for any help!
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
by paulmm123 » Tue Feb 16, 2016 5:07 pm
I can conclude that for boolean types, is not necessary pre check of bits as :

if (stream->writeFlag(mask & bitMask))
stream->writeFlag(mMyBool );

So instead I write and read directly the boolean...
stream->writeFlag(mMyBool );

mMyBool = stream->readFlag();

This is what I've seen in others codes as player.cpp ...
Posts: 5
Joined: Fri Feb 12, 2016 7:54 pm
by paulmm123 » Wed Feb 17, 2016 3:44 pm
is working perfectly, i tested both client and server with sounds too.
I tried to keep orginal code the maximum that.
Thanks RichardM by code.
Posts: 67
Joined: Fri Oct 02, 2015 1:03 am
by JackStone » Fri Mar 18, 2016 12:35 am
Hi all,

I was going to make my own topic for this, but since this post is so recent, I will add my question to this post, hopefully it will get seen.

I am also having issues with this resource. I have the code compiling with no difficulties, and I have created the example door provided with the resource in my level.

With the door closed, I cannot pass through it, which is expected.
I can then call %obj.opendoor(), which plays the open animation, provided the player isn't blocking the door, this is expected.

However, even with the door open, I still can't pass through, it seems there is an issue with the collision. This is the same issue I had with doors, which is why I downloaded this pack.
I also cannot play the closedoor() animation at all, it returns 0, even when the player is not blocking the door.

I tried this with and without the code changes given in this thread.

I think we really need a good door resource working and included in the engine, it is a standard feature with any game project. If I can't get the working, I will have to resort to my usual method of creating doors, which is to create a door object with no collision, then create another invisible object with collision, and move the invisible object as the door opens using .settransform().

This works, but it's not ideal, I'm sure we can do better!
Posts: 162
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Thu Mar 16, 2017 3:43 pm
I have a door working with collisions and all using the basic shape base datablocks and two triggers so you know which way the person is at the door so it always swings away from the player, u don't need an extra resource to do this lik
9 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests