Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] 2.0.21 ObjectRayCast

Author
Message
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 8th Sep 2016 07:20 Edited at: 8th Sep 2016 12:22
ObjectRayCast , dont work on scaled objects when i use SetObjectScalePermanent.
edit: Both animated and static objects if they have more then one mesh.
best regards Preben Eriksen,
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 8th Sep 2016 12:19
Done more testing. only happens if object has more then one mesh , test code:

best regards Preben Eriksen,
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Sep 2016 13:41
This sounds like the same problem I reported a few weeks back with animated models. Wasn't sure if it was because of the animation / bones. But basically, I scaled an animated model but could only get a hit with a ray cast by shooting the character in the foot.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Sep 2016 14:33
I found a bug with SetObjectScalePermanent not reducing the size of the bone collision boxes when using scale values less than 1, this would cause ObjectRayCast to return a hit more often than expected for this object. This is fixed for the next version. But I don't have any multi-mesh objects to test your specific case. Could you send me the model you are using?
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 8th Sep 2016 15:20
Did some more testing , it happens on all objects that has bones , the object dont have to include any animation , but if a bone is defined the collision dont work:

Workaround for static object with bones defined but no animation:


So any object that have boneweights and boneindices set will not work when objects is scaled.
When i remove boneweights and boneindices collision works.

But still this is not a fix for animated object, so im kind of stuck here , is it possible to get a quick fix for collision on animated objects ?

Thanks Paul


best regards Preben Eriksen,
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Sep 2016 15:28
Does the attached version work for you? Place it in the "Tier 1\Compiler\interpreters" folder

Attachments

Login to view attachments
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 8th Sep 2016 17:49 Edited at: 8th Sep 2016 17:56
Hi Paul,

Looks like the scale is fine now ,BUT its really not accurate enoff or usefull, see screenshots:
If you looks at screenshot1 , it looks like the boundaries goes ALL the way down until the object ends.
screenshot2 is just another hit point.

So your hitting stuff all the time even if you dont see anything in that spot.

This object has 4 bones , if that makes any difference ?

The object is tree05.x from the GG default media.

Perhaps a setting if you want to use mesh or bone for collision ( per object ), would do the job , the bone way might be better for some animations.

EDIT FORGOT: ObjectSphereSlide still did not work.
best regards Preben Eriksen,

Attachments

Login to view attachments
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 9th Sep 2016 09:06
More testing on the new bones collision.

The lightmapper in gg loader does 4 million rays , i timed it and:

Bone collision took: 26 minutes to run.
Mesh collision took: 5 minutes to run.

I actually had a feeling that bone would be mush mush faster but ...

This is using the new windows interpreter you sent me ( you can see the scale is fine but...):

If you look at the screenshots you see that the bone collision is not only slow but also they ALL have squared collision boxes and will never be useful.
best regards Preben Eriksen,

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 9th Sep 2016 13:34
The bone collision will never be perfect since it fits the bone collision box around the verticies that it modifies, which will overestimate the space, but it works fairly well on animated characters where the vertices are grouped into limbs which can be roughly approximated by a box. In this case it might be beneficial to have a separate object that is used for collision, you could load the trees with LoadObject to get a mesh version, although it won't update with the animation. It would be very difficult, and slow, to have it both ways (accurate mesh collision that updates with the animation)
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 10th Sep 2016 10:57
LoadObject is not really a option , as it will merge the LOD meshes down to one and nearly triple the poly count.

I could separate a collision mesh from the original objects and use this , but that would use mush more memory ( and time processing ), and are not really mobile friendly.

I tried the collision on different animated objects with limbs and it works pretty great, but AppGameKit switch to bone collision on static/animated objects that have LOD defined in the bones, most of these objects don’t really have limbs or proper defined bones to be used for collision , this is not only the GG media i tried objects from other sources with the same result. This is not only trees but also rock formations, gates , doors etc…

I can separate a collision mesh, but i only see this as a workaround as it use more memory and takes time to process.

AGK already have both bone and mesh collision, so why not make a new command like: SetObjectBoneCollision(obj,1) to turn on bone collision on a object.

“Animated mesh collision” is not needed , there is already bone collision for these types of objects and it works great, but AppGameKit should not default to bone.

Im just looking for a way to get the mesh collision like in 2.0.20 that worked so great ( except for “some” animated objects ).

Would it be possible to get the Mac interpreter with the bone scale issue fixes, so i can start to work on a workaround for this problem ?

Thanks for your help Paul
best regards Preben Eriksen,
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 16th Sep 2016 14:03
Any col news ?
best regards Preben Eriksen,
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 26th Sep 2016 13:51
Hi Paul

I really like to use bone collision on characters like in this demo:
http://www.daily3d.com/mobile/fantasymorning/fantasypack.html

But i still have the bone scale issue you fixed, are there any planned update in the near future to fix these issues ? , also are there any plans that would enable us to select if we want to use bone or mesh collision on a object ( so separate collision meshes is not needed ) ?

Thanks.

best regards Preben Eriksen,
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Sep 2016 21:03
The scale issue is fixed in the next version, I don't know when that will be yet. There are no plans to change animated objects to use mesh collision as it is less reliable than bone collision, and a separate low poly collision object would actually be the fastest method available. It also wouldn't use that much memory compared to the high poly object.

Login to post a reply

Server time is: 2024-11-25 01:26:17
Your offset time is: 2024-11-25 01:26:17