Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Wrong actor3d detection  (Read 4202 times)

0 Members and 1 Guest are viewing this topic.

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Wrong actor3d detection
« on: December 11, 2006, 02:32:20 PM »

Hi! I have some actor3dx for minigame and "occassionaly" find very bad thing: sometimes WME doesn't detect active object (Game.ActiveObject) truly. I don't understand what the matter, but now this is big trouble for me :(

In example there are two objects only: telephone and ringer (both actor3dx type). The ringer is in telephone. The objects display correctly, but Game.ActiveObject is wrong! (when mouse cursor is over ringer) So there is only one object in the scene -- telephone. How to avoid this situation? Any ideas?

(temporary file removed)
« Last Edit: December 13, 2006, 09:01:44 AM by mRax »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Wrong actor3d detection
« Reply #1 on: December 11, 2006, 03:17:25 PM »

I can't test it right now, but I suppose the problem is the "z-order" of the two objects. The ringer is painted earlier than the phone, so from the engine's point of view the phone is on top of the ringer.
The z-order (or painting order) is determined by the actor's Y position on screen. This works fine for characters, but for this specific case you'll need to fake the order somehow. One possible solution is: create two scene regions in SceneEdit, one called "phone" and one called "ringer". Change their order appropriately (phone is first in the list, ringer follows). In the scene_init.script attach the 3D actors to the regions:

phone.StickToRegion("phone");
ringer.StickToRegion("ringer");

That way the ringer is painter *after* the phone and it should work as you need it.
I hope that helps.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Re: Wrong actor3d detection
« Reply #2 on: December 11, 2006, 04:07:09 PM »

Well, this isn't universal solution, but it's really help me now. Thanks! :)

Huh, another question ;)
Code: [Select]
ac.Active=FALSE;
Sleep(1); // without this line the "ac" doesn't dissapear
ClickObject=Game.ActiveObject;
ac.Active=TRUE;
After I started use .StickToRegion, I found new trouble: time, elapsed between command "ac.Active=FALSE" and dissapearing actor3dx object "ac", aren't zero. So because of object "ac" is always under mouse cursor, Game.ActiveObject contains of "ac". To proceed command "ac.Active=FALSE" I used "Sleep(1)" to wait for the object vanish, but there's not accessible solution. Is some actor3dx method to do elementary object tick?
« Last Edit: December 11, 2006, 04:27:22 PM by mRax »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Wrong actor3d detection
« Reply #3 on: December 11, 2006, 05:08:30 PM »

never enountered this, but maybe you can make something like this:

Code: [Select]
ac.Active=false;
while(ac.Active) Sleep(1); // without this line the "ac" doesn't dissapear
ClickObject=Game.ActiveObject;
ac.Active=true;

The reason is that on slower machines your code may not be enough. I think that Game.ActiveObject maybe
gets updated in another thread so this will force sync.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Wrong actor3d detection
« Reply #4 on: December 11, 2006, 06:16:41 PM »

Well I think your solution with Sleep is feasible. The Sleep call causes the engine to repaint screen and update the engine state (including the Game.ActiveObject property). Although I don't really see the purpose of the code.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Re: Wrong actor3d detection
« Reply #5 on: December 12, 2006, 12:57:39 PM »

About purposes =) Here is very simple example. Player must take telephone's cover and drop wherever, and then put the ringer item from inventory to the telephone. Finally, player must put telephone's cover back to the telephone.

About trouble... Look for game.script and delete Sleep() procedure (there's only one). And then for example, you can take the cover too, but you will never can use it on telephone. By the way, the trouble is specified not for .Active property only, but for .DropToFloor one also. Look for Sleep() procedures in class_iih.script.

(temporary file removed)

P.S. I suppose, my english wasn't very bad :)
« Last Edit: December 13, 2006, 11:54:25 AM by mRax »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Wrong actor3d detection
« Reply #6 on: December 12, 2006, 06:34:21 PM »

Wouldn't it be possible to make the cover part non-interactive while it's being dragged?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Re: Wrong actor3d detection
« Reply #7 on: December 13, 2006, 08:59:55 AM »

It's ingeniously! :) I'll really do that.

And what about .DropToFloor property? Is the feasible solution in using Sleep(1)? (As I thought, WaitFor(object) didn't solve the problem)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Wrong actor3d detection
« Reply #8 on: December 13, 2006, 09:42:19 AM »

I admit I didn't even try to understand your code, but in this case I'd recommend setting DropToFloor to false and only modify the PosY property when needed (ie. when you take/drop the object).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Re: Wrong actor3d detection
« Reply #9 on: December 13, 2006, 11:53:57 AM »

I understood :) Thanks a lot.
Logged
 

Page created in 0.046 seconds with 20 queries.