Page 1 of 1

Portal

Posted: Sat Dec 13, 2014 6:40 pm
by Mysterious
Hi does anyone know how the Portal Object works? I though it was like a Teleport with set coordinates. I walk through it but just a white screen lol, Thank you for any help on this :)

Re: Portal

Posted: Sat Dec 13, 2014 7:15 pm
by minmay
PortalComponent has an onArrival hook that is executed after the fade. If you don't put something in the onArrival hook then nothing will happen after the fade to white. (The portal objects in the standard assets play the ending videos on arrival, and videos won't play in the editor.)

Re: Portal

Posted: Sat Dec 13, 2014 7:25 pm
by Drakkan
as minmay said, you can modify what will happen with onarrival part. here is copy from definition in case you have overlooked

Code: Select all

defineObject{
	name = "portal",
	components = {
		{
			class = "Model",
			name = "frame",
			model = "assets/models/env/portal_frame.fbx",
			staticShadow = true,
		},
		{
			class = "Portal",
			onArrival = function()
				GameMode.completeGame("assets/videos/outro1.ivf")
			end,
		},
		{
			class = "Light",
			offset = vec(0, 1, 0),
			type = "point",
			color = vec(0.9, 1.0, 1.3),
			brightness = 12,
			range = 6,
			castShadow = true,
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*1 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 15)
			end,
		},
		{
			class = "Particle",
			particleSystem = "portal_particles",
			emitterMesh = "assets/models/env/portal_rim_emitter.fbx",
		},
		{
			class = "Particle",
			name = "particle2",
			particleSystem = "portal_particles_radial",
			emitterMesh = "assets/models/env/portal_radial_emitter.fbx",
		},
		{
			class = "Particle",
			name = "shipSymbol",
			particleSystem = "portal_particles_island",
			emitterMesh = "assets/models/env/portal_ship_emitter.fbx",
		},
		{
			class = "Model",
			name = "portalBeam",
			model = "assets/models/env/portal_beam.fbx",
		},
		{
			class = "Model",
			name = "planeModel",
			model = "assets/models/env/portal_plane.fbx",
		},
		{
			class = "Controller",
			onDeactivate = function(self)
				self.go.portal:disable()
				self.go.light:disable()
				self.go.particle:disable()
				self.go.particle2:disable()
				self.go.shipSymbol:disable()
				self.go.portalBeam:disable()
				self.go.planeModel:disable()
			end,
		},
	},
	placement = "wall",
	tags = { "door" },
	editorIcon = 124,
	automapIcon = 84,
}