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 / Raycasting with scaled objects

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 7th Aug 2016 18:41
Does anybody know the current state of raycasting / hit detection with scaled, animated objects?

I've got a soldier model in my current project and I'm only able to shoot him in the foot.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 9th Aug 2016 09:51
Perhaps thats why I've been having raycasting issues in my zelda game, the objects are scaled!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Aug 2016 11:57
as workaround may try SetObjectScalePermanent ( objID, x, y, z ) (not SetObjectScale)
Quote: "Description
Modifies the object size in the X, Y, and Z directions. This modifies the object's vertices which makes this a permanent change, and is slower than SetObjectScale.
This command does not read or affect the values set with SetObjectScale so using SetObjectScale(ID,2,2,2) and then setting a permanent scale of 3,3,3 would still draw the object 2 times bigger than normal, which means 6 times bigger than when you started.
This command does not affect any child objects that may have been loaded with it, nor any objects attached to it with FixObjectToObject.
This command will work on bone animated objects as long as the scale is uniform, i.e. the X, Y, and Z scale values are all the same. "
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 9th Aug 2016 13:41
SetObjectScale() doesn't work with animated bones, so I'm already using SetObjectScalePermenant().
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Aug 2016 20:23
hmm, then it seems its something for paul.
can you provide a example as zip?
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 10th Aug 2016 21:36
Here's the model I'm having problems with. Unscaled it seems to work fine with ObjectRayCast. After using SetObjectScalePermenant it doesn't.

Attachments

Login to view attachments
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 12th Aug 2016 13:18
AGK dont support bone scaling perhaps that also has something to do with the collision ?, tried to look at your soldier (see pic) using preview, and it looks like it has some kind of scaling

Try to run in debug mode and see if you get this:
"Object animation contains scale values, scaling of bones is not supported and will be ignored".

Try to separate the gun and the soldier into 2 objects, and try not to use any scaling.
best regards Preben Eriksen,

Attachments

Login to view attachments
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 12th Aug 2016 20:02
Yes I get that message, but it was my understanding that the bone scaling message was just a warning. It may be related to the collision, but I would have thought collision was calculated based off mesh rather than bones.

The gun doesn't give me any obvious problems. I'm able to position it as a child object and it works great.

I'm wondering if Paul has anything to say about this? I get this kind of problem all the time with models I've bought. It's really holding AppGameKit back as a 3D development tool.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Aug 2016 18:42
So far animated objects have used the original static mesh for ray casts, when the bones deformed this mesh the changes weren't taken into account. For the next version I'll change it to use the bone bounding boxes to check for ray casts, it won't be 100% accurate when compared to the deformed mesh but it should be a lot more useful than it is now.
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 17th Aug 2016 21:28
Thanks for the update, Paul.

Login to post a reply

Server time is: 2024-11-25 04:29:16
Your offset time is: 2024-11-25 04:29:16