Doors

Discuss artwork in all of its forms here, from level design to GUI button themes. New MODs planning, work-in-progress and other samples are welcome in this forum as well.
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Doors

Postby arfur9 » 2017-03-02, 12:20

The game I hoping to do is more an adventure game not a shooter, it will be a first person view
The game will be in a regular house with opening swing doors like any home... so on that note, what is the best way to do this?
An animated door or rotate the door by script?
Would it be possible to trigger the door by a mouse/cursor click on the door handle?
Also locked doors requiring a key?
User avatar
Carsten
Site Admin
Posts: 2137
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Doors

Postby Carsten » 2017-03-02, 13:07

All doable!
Have you seen viewtopic.php?p=6915#p6915?
I may rewrite this in greater detail if required.

An adventure is a great idea, I'm very much looking forward to it!
Best regards,
Carsten
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-02, 15:20

Yes I did see it, I'm not very good with lua

I'll persevere a while longer, I'll create a door in the context and I'll see if I can get it working

Can the door be a model? I don't appear to be able to get a model to move and I've noticed that the lifts etc examples are primitives.
User avatar
Carsten
Site Admin
Posts: 2137
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Doors

Postby Carsten » 2017-03-02, 15:38

Yes, doors can be models, just add a component as required.
Let me know if you need help.
Best regards,
Carsten
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-02, 17:59

I will don't worry :)
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-03, 14:49

Ok I know have a door triggering but not a swing motion, looking at the MoverBinary this hasn't been added yet?
I thought it might be able to use something like

Code: Select all

SetRotation(e,0,90,0)


I'm not to bothered if the door swings instantly open from 0 to 90 degrees right now, I can try to make it better later :)
User avatar
Carsten
Site Admin
Posts: 2137
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Doors

Postby Carsten » 2017-03-04, 12:02

I've added an issue for this, please see https://bitbucket.org/cafu/cafu/issues/ ... nentmovert for details.

I'll look into it, but if you want a quick solution, just move the doors out of the way linearly.
Best regards,
Carsten
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-04, 12:17

I guess the "easier" solution would be to animate the door?
Have a range of 100 frames, frames 0 to 49 open the door, frame 50 to 100 close it

Can we call a particular frame range?
User avatar
Carsten
Site Admin
Posts: 2137
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Doors

Postby Carsten » 2017-03-04, 18:57

In theory (I'm quite sure but have not tried), this can be done, especially if you can make it so that the door has two animation sequences: opening and closing.

The better solution however is (fixing #156 and) using the MoverBinary.
Best regards,
Carsten
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-04, 19:19

The MoverBinary is a lot more use to me as I'm a Sketchup user, we can't export animation
I'm trying an animated door with Blender :)

But even the Blender game engine uses a script rather than animation
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-05, 11:18

it was really easy to get the door to open

Code: Select all

local Trigger = ...

function Trigger:OnTrigger(Other)
    -- Don't re-enter this code while we're still busy.
    if self.IsBusy then return end
    self.IsBusy = true

    local Map   = world:GetRootEntity()
    local AniRun= Map.doorani:GetComponent("Model")
     AniRun:set("Animation",1)
    Console.Print("Door close triggered!\n")

    -- Wait 2.1 secs, then become available again for the next trigger action.
    coroutine.yield(2.1)
    self.IsBusy = false
end


I guess now I need to figure out either a mouse/cursor click action or maybe keyboard input? ie a message to click a key to open or close
User avatar
Carsten
Site Admin
Posts: 2137
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Doors

Postby Carsten » 2017-03-06, 10:24

arfur9 wrote:I guess now I need to figure out either a mouse/cursor click action or maybe keyboard input? ie a message to click a key to open or close


At this time, the easiest solution by far is to use a trigger volume, possibly a very thin one so that the player must be very close to the door in order to open it (or have his key inventory checked).

Next easiest solution is using a GUI panel.

If you want something like a "Use" key, I'd have to look into it. Key mapping is not something that works easily or well yet.
Best regards,
Carsten
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-06, 12:03

Right now I have a trigger close to the door with a isopen condition, most doors once open can stay open, it would be exterior doors that need to close

Have you had any luck with the GUI problem?
User avatar
Carsten
Site Admin
Posts: 2137
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Doors

Postby Carsten » 2017-03-07, 11:55

I was looking into the rotating movers issue #156 first, because that is the slightly simpler problem and I was not aware if there are any priorities.
Regarding #157, don't expect results too quickly: this is a complicated problem that requires careful planning.
Best regards,
Carsten
User avatar
arfur9
Posts: 69
Joined: 2017-02-25, 18:57
Location: uk
Contact:

Re: Doors

Postby arfur9 » 2017-03-07, 14:37

I'm just interested, the GUI is a nice feature :)

Return to “Models, Materials, Textures, Sound, Music, ...”

Who is online

Users browsing this forum: No registered users and 0 guests