Author Topic: It's something wrong in wgetnoderotation?  (Read 447 times)

0 Members and 1 Guest are viewing this topic.

Offline jepalza

  • Friends
  • Gentleman (Lady)
  • *
  • Posts: 42
  • Reputation 5
  • 3D Crazy
It's something wrong in wgetnoderotation?
« on: October 20, 2015, 03:44:11 PM »
In example "13_CameraPosition.bas", node rotation for camera initial is "4, -461.63, 0", but, when it's reading with "wgetnoderotation", values are "47, 258.37, 0" (without move or rotate it)
It's possible, or it's an error of 0.95 version?

Offline Alec - WS3D Developer

  • Producer
  • Administrator
  • Viscount
  • *
  • Posts: 782
  • Reputation 30
  • Game making is my hobby for life!
Re: It's something wrong in wgetnoderotation?
« Reply #1 on: October 20, 2015, 04:42:04 PM »
Interesting. I'll check it.
WorldSim3D = 3D + FreeBasic. Программируй в удовольствие, а не "в тягость"! Make your project with pleasure, not with strain!

Offline Alec - WS3D Developer

  • Producer
  • Administrator
  • Viscount
  • *
  • Posts: 782
  • Reputation 30
  • Game making is my hobby for life!
Re: It's something wrong in wgetnoderotation?
« Reply #2 on: October 20, 2015, 06:32:06 PM »
First, there is an error in the code of the example. Both for the position and the rotation of the CameraNode are used the same variables X Y Z. It doesn't affect the metrics of the rotation, but it should be fixed anyway. For the position and rotation must be used different variables, of course.

Now, as for rotation. Actually, yes wGetNodeRotation shows wrong values, but when I start rotating the camera with the mouse, the values are correct. I don't know why and I'll try to fix it. So the wrong values are with initial parameters of the Camera. Also it should be checked if these wrong values refers to all types of nodes and not just camera node.
« Last Edit: October 20, 2015, 08:04:50 PM by Alec - WS3D Developer »
WorldSim3D = 3D + FreeBasic. Программируй в удовольствие, а не "в тягость"! Make your project with pleasure, not with strain!

Offline jepalza

  • Friends
  • Gentleman (Lady)
  • *
  • Posts: 42
  • Reputation 5
  • 3D Crazy
Re: It's something wrong in wgetnoderotation?
« Reply #3 on: October 20, 2015, 06:55:23 PM »
OK, thanks

Offline Alec - WS3D Developer

  • Producer
  • Administrator
  • Viscount
  • *
  • Posts: 782
  • Reputation 30
  • Game making is my hobby for life!
Re: It's something wrong in wgetnoderotation?
« Reply #4 on: October 28, 2015, 05:59:48 PM »
Ok, I have found a temporary solution.

I noted that if I initialize a camera's rotation values with wSetNodeRotation before the main loop (While wRunning ... Wend) like in the example 13, then wGetNodeRotation returns wrong values. But if I initialize them within the main loop, wGetRotation returns correct values.

I do it like that:
Code: [Select]
Dim timer_1 as integer = 0

While wRunning
...

timer_1 +=1

If timer_1 = 1 Then
wSetNodeRotation (CameraNode, 2, 355, 0 )
EndIf


Wend
WorldSim3D = 3D + FreeBasic. Программируй в удовольствие, а не "в тягость"! Make your project with pleasure, not with strain!

Offline Nikolas - WS3D Developer

  • Programmer
  • Global Moderator
  • Viscount
  • *
  • Posts: 622
  • Reputation 45
Re: It's something wrong in wgetnoderotation?
« Reply #5 on: October 28, 2015, 08:14:11 PM »
Add to said Alec.
1)WS3D (like Irrlicht) begins to work correctly with functions of rotation (and many other too) only after the main loop of the application will occur at least one time. If you want to avoid problems, do this:

.....
Camera = wAddFPSCamera
.......
wBeginScene(0,0,0,0)     '(see example 116, lines 207-211)
wDrawScene
wEndScene

.......
wSetNodePosition( CameraNode, 0, 1, 0 )
wSetNodeRotation( CameraNode, 4, -461.63, 0 )
wSetCameraClipDistance ( CameraNode, 6000 )
'--------------------------------------
WHILE wRunning  'main game loop
.........
wend

2)If the values of angles over 360 degrees, you should consider it:

-461.63 <=> -461.63+2*360 <=> 258.37
« Last Edit: October 28, 2015, 08:23:44 PM by nikolas »
Под лежачий камень мы всегда успеем...

Offline Alec - WS3D Developer

  • Producer
  • Administrator
  • Viscount
  • *
  • Posts: 782
  • Reputation 30
  • Game making is my hobby for life!
Re: It's something wrong in wgetnoderotation?
« Reply #6 on: October 28, 2015, 09:31:17 PM »
Aha! That's where the trouble lies! (For Russian users: "Вон где собака зарыта!").
Now I have thoroughly looked through the 116th example's code and noted these lines, mentioned by nikolas in the previous post:

Code: [Select]
wBeginScene(0,0,0)
wDrawScene
wEndScene

They are before the main loop.

So, we should consider the fact in order to have a workable code.
WorldSim3D = 3D + FreeBasic. Программируй в удовольствие, а не "в тягость"! Make your project with pleasure, not with strain!

Offline jepalza

  • Friends
  • Gentleman (Lady)
  • *
  • Posts: 42
  • Reputation 5
  • 3D Crazy
Re: It's something wrong in wgetnoderotation?
« Reply #7 on: November 02, 2015, 04:44:26 PM »
Sorry, i'm was missing for a few days ;-)

Thanks for answers, go to try it out.

Offline Alec - WS3D Developer

  • Producer
  • Administrator
  • Viscount
  • *
  • Posts: 782
  • Reputation 30
  • Game making is my hobby for life!
Re: It's something wrong in wgetnoderotation?
« Reply #8 on: November 02, 2015, 07:49:05 PM »
Quote
Sorry, i'm was missing for a few days ;-)
It's OK.
I should answer one more question.
WorldSim3D = 3D + FreeBasic. Программируй в удовольствие, а не "в тягость"! Make your project with pleasure, not with strain!

Offline jepalza

  • Friends
  • Gentleman (Lady)
  • *
  • Posts: 42
  • Reputation 5
  • 3D Crazy
Re: It's something wrong in wgetnoderotation?
« Reply #9 on: November 04, 2015, 09:48:42 AM »
Yes, besides this post, i'm trying to make a class of "world spawn player position" reading info from BSP map (INFO_PLAYER_START and INFO_PLAYER_DEATHMATCH) in order to put player position on this values, with "wsetnodeposition", but, anything is wrong, random values are generated  :-[ (i'm studiyng code, to look for mistakes, besides). If "worldspawn" is "100,200,300" for example and then, make:
wBeginScene
wsetnodeposition(bla,bla..)
wDrawScene
wEndScene
First time, "maybe" is correct, but not at all is correct, something times, random position is generated with real values, and my player appear in the air or far away from map.

i don't know nothing. It's very strange