ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Script-spawned LC direction misbehavior

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  15:49:46  16 January 2015
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454
Script-spawned LC direction misbehavior

Whenever I try to spawn a level changer with edited packet data, the resulting direction is completely different from what I entered. Here is the script:

local lChanger = alife():create( "level_changer", db.actor:position(), db.actor:level_vertex_id(), db.actor:game_vertex_id() )
local lcData = packet_utils.get_object_data( lChanger.id )

lcData.shapes = {}
lcData.shapes[ 1 ] = {}
lcData.shapes[ 1 ].shtype	= 0
lcData.shapes[ 1 ].radius	= 1
lcData.shapes[ 1 ].offset	= vector():set( 0, 0, 0 )
lcData.dest_level_name		= goLevel
lcData.dest_position		= location.position
lcData.dest_direction		= location.direction
lcData.dest_game_vertex_id	= location.gvid
lcData.dest_level_vertex_id	= location.lvid
lcData.silent_mode			= 1
lcData.story_id				= 8657

packet_utils.set_object_data( lChanger, lcData )


The location entries are formatted like this:

{	position	= vector():set( 189.562,0.095,117.508 ),
	direction	= vector():set( 0.015,0.000,1.000 ),
	lvid		= 45833,
	gvid		= 1190,
	},


It goes to the right level, right vertex IDs, right position, but the direction is always wrong. I've tried just putting a static value in for dest_direction such as vector():set( 1, 0.5, 0 ) but even that always comes out facing something different (-0.479, 0.000, 0.878 for that input according to db.actor:direction()).

Is this a bug with packet_utils? Is there something I'm missing about how direction works? I'm stumped.
  03:51:05  22 April 2015
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
Messages: 4302
Just in case you might still be working on this:

The right-hand rule applies to the Y-coordinate for the primary component of level changer direction. My second post (#286997) on page 188 of the ZRP thread in reply to Storm Shadow might help.

---QUOTATION---
"ZRP - A joint effort in fixing S.T.A.L.K.E.R.", page 188:
https://www.gsc-game.com/main.php?t=community&s=forums&s_game_type=xr&thm_id=11786&sec_id=16&page=188
---END QUOTATION---


Some revision applies if you use the code from the ZRP: You no longer need to set the direction by moving a bit in the ZRP. It now uses the always-valid device().cam_dir value for the direction instead of db.actor:direction(). And you should still be able to use the X and Z values to set the vertical view angle as noted in the linked TMI post (thm_id=17494).
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2022 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.