Adding videos for levers

Other than the color-matching problems with videos that we discussed earlier, adding videos for linking nodes/rooms via doors and adding small looping videos to spots has been going smoothly. Now, however, I am having trouble figuring out how to add in videos that launch by clicking on items like lever handles.

With the doors, you’re usually looking straight at a cube side, so you can lookAt a node side and the camera positions nicely. With a lever that’s on the bottom of the cube and at an angle, I’m having problems positioning the camera. I’ve tried going to a slide, but that sometimes seems awkward as well. Also, when exiting the video, I sometimes need a switch and need to be looking in a different direction than at the start of the video. Sometimes when exiting a video (and I really can’t figure out why this is happening), the panning of the mouse is restricted as though still stuck in a slide — I can only move forward through the remaining nodes.

I’m wondering if anyone else has gotten to this point and found a solution to the problems that I’m having. (I’ve juggled spots at least fifty ways without great success.)

You can perform an “instant” lookAt. To achieve this, the third parameter should be “true”. Additionally, you can define custom angles. Just put the numbers instead of the cube faces (though you might need a bit of trial and error to get the right angle; I should add the current angles to the debug info).

I assumed that adding in these more complex links would be so easy, but just when I thought I’d gotten it, LUA wrestled me and won… :frowning: Those are two great tips, though, Agustin. I’ll tackle things again and report back. :slight_smile:

Post Edited for Clarity: Using co-ordinates with lookAt works.

[code]–ride to top
CableCar_ride_to_GY = AI4:addSpot( Spot(EAST, {64, 424, 1984, 424, 1984, 2048, 64, 2048}, {sync = true}) )
CableCar_ride_to_GY:attach(AUDIO, “CableCar_Up_AI4-GY1a.ogg” )
CableCar_ride_to_GY:attach(VIDEO, “cable_car_AI4_GY1a.ogv” )
CableCar_ride_to_GY:disable()

–push lever
lever_AI4 = AI4:addSpot( Spot(DOWN, {1709, 372, 1943, 372, 1943, 592, 1709, 592}) )
lever_AI4:attach(FUNCTION,
function()
self:setCursor(USE)
lookAt(90, 0, true) – (90, -180, true)
CableCar_ride_to_GY:enable()
CableCar_ride_to_GY:play()
CableCar_ride_to_GY:stop()
switch(GY)
lookAt(270, 0, true)
end)[/code]

I changed the first lookAt to look EAST like the video by using 90, 0. I still have the odd “placement” of the video as the handle to the lever is on the DOWN side of the cube. I’d like to fix this by entering the correct angles for the video to replace EAST. I know the angle of the camera in Vue, it’s x = 135, y = 90 (up is 0 in Vue and down 180). Converting to Dagon’s Up/Down of 360/-360, I get the horizontal of 90 and vertical of -180 for the first lookAt. I’m assuming those are also the angle amounts for the video? So, do I just substitute 90, -180 for EAST?

One more problem —if the camera is in movement when the handle of the lever is clicked, the camera continues to move, and you can see the cube with the video playing on it at an angle. Just to be sure that stretching the video wasn’t somehow causing problems, I reprocessed it to be 1920 x 1200, but I can still see the cube edges if the mouse is in motion. Here’s a screenshot -
http://www.realmsforge.net/snap-2012-12-08-18h46m21s.jpg

Also, my player is in a cable car, so upon arrival, I’d like to not have the footsteps play or the incremental advancing of the camera. Can I take that out for just the arrival?

Okay, the weekend is at a close and it’s time to get ready for the “real” work week. :frowning:
Working on Adamantus this weekend has brought up several questions for me.

  1. Is there a command that can be input in the ingame editor to find the camera angles?

  2. Can the camera be made to return to and lock on a specified (lookAt) direction when a spot to activate a video is clicked while the mouse is in motion? (If the camera is not in motion when the spot is clicked on, there’s no problem.)

  3. Is there a way to override or deactivate the footsteps sound and walk simulation for a specific switch? I really need to do this. When my cable car arrives you not only seem to be walking the last bit, but the screen flashes back to the starting room before switching completely to the new node. (I resorted to my usual technique when stumped — “cooking” with functions. I tried using the bools canWalk, performWalk, and simulateWalk all without success. :cry: )

  4. Is there a way to override or deactivate the automatic BACKWARDS button when switching from slide to slide? (I have a device that opens and closes and must be revisited. I get stuck between the opening and closing slides, without a way to exit back to the node. Using onReturn works well for getting from the open slide back to the closed one, but I need to get back to the node from the closed slide. Which brings up my next question…)

  5. How do I switch from a slide to a node and have the camera begin to pan again? In the above example, I tried to use a function with onReturn to always switch back to the node from the closed slide. The switch happens, but lookAt gets ignored and the camera is stuck in non-panning mode once on the node. And just a note — anything other than 0, 90, 180, or 270 for the horizontal seems to make the camera spin instead of lock while the video is (presumably) playing.

On the plus side, I got a lot done and was also working on a way to simulate videos by flipping an image sequence with a timer on an overlay. If I can get that to work, I’ll post it, but that will have to be another day. :lazy:

Hhmmm… Let’s see:

  1. As a matter of fact, yes. Do “print(camera.horizontal)” or “print(camera.vertical)” to get the current set of coordinates.

  2. I think I understand what you mean, the inertia effect leaves the camera in an undesired position. I have to fix this; for now, you can try doing a smooth lookAt when the spot is clicked, regardless of the position of the camera. The engine will attempt to lock in those coordinates.

  3. You can do this manually, the new syntax is “camera.walk = false”. You can set it to false before performing the switch, then true. Should work!

  4. Yes, you can. When creating the slide, set the third parameter to true. That tells Dagon you’ll be using your own spots on the slide.

  5. Hhmmm… This one probably doesn’t work for now. I think it’s got to do with the way slides are handled. Try doing an instant lookAt, which should work. You can also modify the camera angles directly. But the smooth pan, I’m afraid that will need a fix :frowning:

Thanks for those answers, Agustin. I’ve tried them out and these are my results.

  1. “print(camera.horizontal)” and “print(camera.vertical)” work great, thanks! :smiley:

  2. I agree that the inertia effect is probably contributing to the spinning and skewing. I never had the problem with the doors, though, so maybe it has to do with the greater likelyhood of the mouse being in movement when clicking on these smaller spots like the lever’s handle, which are not dead center and level vertically. See my link a few posts up to see what it looks like.

Is a “smooth lookAt” different from this? → lookAt(90, 0, true)

Also, should I be trying to add the same co-ordinates in the corresponding slide’s spot? Like this?->

CableCar_ride_to_GY = AI4:addSpot( Spot(90, 0, {64, 424, 1984, 424, 1984, 2048, 64, 2048}, {sync = true}) )
  1. I could not get camera.walk = false to work. I tried it with and without the true statement and also tried cameraWalk = false, just in case you’d mistyped. :stuck_out_tongue: Here’s what I tried →
--push lever 
lever_AI4 = AI4:addSpot( Spot(DOWN, {1709, 372, 1943, 372, 1943, 592, 1709, 592}) )
lever_AI4:attach(FUNCTION,
	function()
		self:setCursor(USE)
		lookAt(90, 0, true) -- (90, -180, true)
		CableCar_ride_to_GY:enable()
		CableCar_ride_to_GY:play()
		camera.walk = false
		switch(GY)
		CableCar_ride_to_GY:stop()
		lookAt(270, 0, true)
		--camera.walk = true
	end)

4-5. Adding true as the last parameter of the slide entry does indeed get rid of the “auto” BACKWARD and works. I get a USE cursor, though, and can’t seem to get the BACKWARD cursor to override it on the spot. Is there a way to do that? Here’s what I’ve done →

--**spots for both states of the GoStick on 12c
GoStickClosedDetail = Slide("still_Gondola_12c_GoStick_closed.png", "Detail of GoStick closed on 12c", true)
GoStickOpenDetail = Slide("still_Gondola_12c_GoStick_open.png", "Detail of Go Stick opened on 12c", true)

--always go BACKWARD to closed still from open still
GoStickOpenDetail_Return = GoStickOpenDetail:addSpot( Spot({0, 700, 1920, 700, 1920, 1200, 0, 1200}) ) 
GoStickOpenDetail_Return:setCursor(BACKWARD)
GoStickOpenDetail_Return:attach(FUNCTION, 
	function()
		GoStick_Closes:play()
		switch(GoStickClosedDetail)
		GoStick_Closes:stop()
	end)
	
--always go BACKWARD to 12c from closed still
GoStickClosedDetail_Return = GoStickClosedDetail:addSpot( Spot({0, 700, 1920, 700, 1920, 1200, 0, 1200}) ) 
GoStickClosedDetail_Return:setCursor(BACKWARD)
GoStickClosedDetail_Return:attach(FUNCTION, 
	function()
		switch(City)
		switch(City12c)
		lookAt(0, -255, true) --look at GoStick
	end)

That last chunk of script does go from the node to the slide and the lookAt works to position the camera, but then you’re stuck in the slide with a non-panning camera. Clicking the lever again yields a black slide with a bit of what is probably the cube side without the slide attached. If there’s no work around for this (or imminent fix :wink:), I’ll just bypass this area with a direct link to the next room and come back to it later.

Thanks again for your help.

  1. Actually, lookAt’s are always smooth by default. The third parameter specifies if it’s instant when true. The coordinates of the spot have nothing to do with the coordinates of the camera, unless you want 100% precision (even so, it’s never THAT precise). This is likely a bug that I’ll have to reproduce myself to understand :frowning:

  2. My fault, camera.walk disables the walk effect, but NOT the sound FX. I’ll have to allow disabling that as well.

4-5. Right, set the cursor after the attach() function. I should clarify that in the documents, or modify the way both function works. Attach will always try to decide the best cursor for you; if you want another one, you must specify that after attaching stuff.

So yeah, try bypassing that for now because it’s a tricky behaviour that I haven’t sorted out yet. But all that you’re needing here is definitely doable :nod:

Just a follow up - BACKWARDS cursor shows now, but using camera.walk = false does not get rid of either the walk or the sound of the footsteps.

Disabling camera.walk definitely worked here. Try doing it after the first switch in your code. Probably needs fixing as well…

Well rats… I can’t get it to work. I tried it in three places, with and without adding the walk back in at the end.

--**add the spot on 12c to ride to the Mansion GoStick = City12c:addSpot( Spot(NORTH, {905, 1882, 1055, 1882, 1055, 2047, 905, 2047}) ) GoStick:attach(FUNCTION, function() self:setCursor(USE) lookAt(0, 0, true) --look at GoStick Gondola_ride_to_Mansion:enable() Gondola_ride_to_Mansion:play() Gondola_ride_to_Mansion:stop() --camera.walk = false switch(City) --camera.walk = false switch(City13a) camera.walk = false lookAt(45, 0, true) --camera.walk = true end)

Even weirder… Can you try doing it from the console? That’s how I tried it.

I stepped into the vehicle, typed camera.walk = false into the console and clicked the spot. The video played, but at the end I still saw the transition and heard the footsteps. I must be doing something wrong… (I actually sent an email, so you can test at will, if you’d like.)

Just a couple of things that I’m learning as I work with Dagon…

I thought earlier that you could not switch from a slide to a node and retain full camera movement. You can. I misunderstood the use of camera.walk. I was trying to get rid of the transitions and the sound of the footsteps in an instance where I was playing a video on a slide and then switching to a node. The camera was “locking up” as though restrained to the boundarties of a slide/stops 360 degree movement. It was not the process of switching from a slide to a node, but the use of camera.walk = false that was causing the lock up.

All of your TEX files should be 12,289 kb in size. If they are larger, then something’s odd, even though they may work. Several times, it’s been because I left alpha on during postwork. Sometimes I can’t find anything different, but just need to run the cube sides through the ksconvert process again.

Yeah, it occasionally happens to us. Most of the times it’s an extra image being added to the bundle, likely because the naming is very similar. I really need to update the ksconvert tool ASAP…

Agustin, forgive me for reopening this thread, but I need to revisit this subject.

I have several places where I need to switch the player from one room to the next using a video. In all of these instances, the player is seated in a vehicle, so SWITCH needs to occur without

  1. a brief image of the starting node (on arrival)
  2. incremental views of the destination node
  3. footstep sounds.

Is there any way that I can remove the above features of the SWITCH? Or is there an alternative to SWITCH that would do the same thing? Thanks.

[code]–**Video of the gondola ride to the Gov.'s Mansion, 34 secs
–this video needs to stretch
Gondola_ride_to_Mansion = City12c:addSpot( Spot(NORTH, {64, 484, 1983, 484, 1983, 1563, 64, 1583}, {sync = true}) )
Gondola_ride_to_Mansion:attach(AUDIO, “Gondola_12c-13a.ogg” )
Gondola_ride_to_Mansion:attach(VIDEO, “gondola_City12c_City13a.ogv” )
Gondola_ride_to_Mansion:disable()

–**add the spot on 12c to ride to the Mansion
GoStick = City12c:addSpot( Spot(NORTH, {905, 1882, 1055, 1882, 1055, 2047, 905, 2047}) )
GoStick:attach(FUNCTION,
function()
self:setCursor(USE)
lookAt(0, 0, true) --look at GoStick
Gondola_ride_to_Mansion:enable()
Gondola_ride_to_Mansion:play()
Gondola_ride_to_Mansion:stop()
–camera.walk = false
switch(CitySouth)
–camera.walk = false
switch(CitySouth13a)
camera.walk = false
lookAt(45, 0, true)
–camera.walk = true
end)[/code]

No, not yet. I know this is a major requirement for when you have cutscenes in between transitions – I’ll try to implement a “plan switch” ASAP :nod:

I believe this is probably related to the above…

If you click on a spot on a node and play a “travel” video, then switch to a different room or node within the same room, cursor movement is as it should be.

BUT, if you are in a slide and play a “travel” video, then switch to a different room or a node within the same room, the cursor is constrained as though still in the slide — without 360 degree movement.

Examples:
This works fine –

[code]Gondola_ride_to_Mansion = City12c:addSpot( Spot(NORTH, {64, 484, 1983, 484, 1983, 1563, 64, 1583}, {sync = true}) )
Gondola_ride_to_Mansion:attach(AUDIO, “Gondola_12c-13a.ogg” )
Gondola_ride_to_Mansion:attach(VIDEO, “gondola_City12c_City13a.ogv” )
Gondola_ride_to_Mansion:disable()

–**add the spot on 12c to ride to the Mansion
GoStick = City12c:addSpot( Spot(NORTH, {905, 1882, 1055, 1882, 1055, 2047, 905, 2047}) )
GoStick:attach(FUNCTION,
function()
self:setCursor(USE)
lookAt(0, 0, true) --look at GoStick
Gondola_ride_to_Mansion:enable()
Gondola_ride_to_Mansion:play()
Gondola_ride_to_Mansion:stop()
–camera.walk = false
switch(CitySouth)
–camera.walk = false
switch(CitySouth13a)
–camera.walk = false
lookAt(45, 0, true)
–camera.walk = true
end)[/code]

Both of these leave the player “stuck” in a bind -

[code]open_canopyMovie = inShip_LidDown_Detail:addSpot( Spot ({0, 0}, {sync = true}) )
open_canopyMovie:attach(AUDIO, “cryo_opens.ogg”) --temporary
open_canopyMovie:attach(VIDEO, “CanopyOpens.ogv”)
open_canopyMovie:disable()

goPortal = inShip_LidDown_Detail:addSpot( Spot ({0, 0}, {sync = true}) )
goPortal:attach(AUDIO, “cryo_opens.ogg”) --temporary
goPortal:attach(VIDEO, “PortalOpens.ogv”)
goPortal:disable()

–get out of the ship and back into the ship’s bay
getOutShip = inShip_LidDown_Detail:addSpot( Spot({1320, 884, 1574, 884, 1574, 1143, 1320, 1143}) )
getOutShip:attach(FUNCTION,
function()
open_canopyMovie:enable()
open_canopyMovie:play()
open_canopyMovie:stop()
switch(SSShipBay)
–camera.walk = true
switch(SSShip2)
–camera.walk = true
end)
getOutShip:enable()

–push button to start ship’s trip to spaceport
–temporarily goes to City1
goToAdamantus = inShip_LidDown_Detail:addSpot( Spot({368, 921, 580, 921, 580, 1157, 368, 1157}) )
goToAdamantus:attach(FUNCTION,
function()
— need a sound effect here
goPortal:enable()
goPortal:play()
goPortal:stop()
switch(City)
–camera.walk = true
switch(City1)
–camera.walk = true
end)
goToAdamantus:enable() [/code]

In these last two instances, there is a an override for the backwards cursor for the slide.

Indeed, when you’re zooming on a slide, you must zoom out before performing a switch. I will also remove this restriction in future updates, but for now try switching to the previous node first, then to another node/room.

Thanks, Agustin.

Almost all of our exits to different areas involve vehicles of some sort and about half need to start from slides, so that and the ability to turn off the walk transitions will be a big help. :smiley: