Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / A command like Point Object, but with Up Vector.

Author
Message
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 27th Apr 2012 16:12 Edited at: 27th Apr 2012 16:14
Roll was in my first example. I have posted both versions. One with roll, and one without roll. I have posted the code to create everything I can think of. Eyes, trees, freeflight, LookAt. Every time I post the example, someone changes the idea to a new idea.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Apr 2012 16:24
Without a good example of what this is then it's pointless to continue


Join or Support!
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 27th Apr 2012 17:49 Edited at: 27th Apr 2012 17:51
@Sasuke

How to get camera vector?

move camera forward
remember coords
move back

what about axis-aligned billboard?
see TWO lines (per object) in the middle of my snippet

and if it's laser?
add +90

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Apr 2012 18:47
@ mrHandy
Quote: "How to get camera vector?"


I've used that sometime. But usually I use a dummy object and offset limb mainly cause I can alter rotations aswell. Or using a matrix. Mainly cause I don't like the idea of having to move something every frame.

Quote: "what about axis-aligned billboard?"

Try to orient the billboard towards both the camera and the direction the billboard is moving. That's where your coded would have problems.

Quote: "and if it's laser?"

Depends where the lazer is coming from and if it's subdivided. Each segment would be slight different than the last. Say the lazer's diagonal, +90 wouldn't work for that situation.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 27th Apr 2012 21:55 Edited at: 27th Apr 2012 21:57
Are you guys still working on that long code? Look here is the same code with Point Object... much smaller....



Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Apr 2012 23:12 Edited at: 27th Apr 2012 23:50
Again someone misunderstands the point... sorry. Just wanted to sound ironic

Quote: "Look here is the same code with Point Object... much smaller...."


The point of axis aligned billboards is you can define the axis it rotates about, but mainly it's position. Something you can't do with point object. Try doing this with point object:

(I changed the centre of my code)


Also note that I wrote all this quick, so it will need refining.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 00:06 Edited at: 28th Apr 2012 00:24
That's just another refinement.. here is the same thing using Point Object....



You can also put a box where the camera is, and move the box around to change the aim point.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th Apr 2012 05:08
Whoops, put up the wrong code. Will do in the morn. What I was doing was going to set up Arbitrary Axis Billboards.

Basically, try to rotate billboards at a different axis with point object, but an axis you define without moving the object above or below the camera.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 14:41 Edited at: 28th Apr 2012 14:52
Quote: "Basically, try to rotate billboards at a different axis with point object, but an axis you define without moving the object above or below the camera."


Another change. I started with lookat, then look up, then freeflight, then trees, then billboards, then lazers, now it's something else. Basically, just mess with the point object code to get what you want. It's a single line so much faster if you have 10,000 objects to turn. This new idea sounds like a box chasing the camera, and you point at the box. It's still the same code as I posted, but with a box again.

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 28th Apr 2012 15:05
I don't get it. We solved the problem, didn't we? If not, please provide a explanation picture.

«It's the Shader, shader me this, shader me that»
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 15:27 Edited at: 28th Apr 2012 15:33
Quote: "I don't get it. We solved the problem, didn't we? If not, please provide a explanation picture."


Unless he just means this....

point object n,camera position x(),Camera position y(),Camera position z()


Point at the camera, not above, or below it?

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th Apr 2012 15:37
Quote: "Another change."


No it isn't. It's still the same thing I was going on about and that's defining an axis of rotation except that it is and arbitrary one, which you can't do with point object. Like rotating an object y:45 and x:45 then rotating rotating about it's x axis. Anything on the y axis is simple with point object. But when you start to introduce x and or z together, it becomes far to complex.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2012 15:40 Edited at: 28th Apr 2012 16:08
You put a box where the camera is, and move it left, and right. That's what I said before. Point object works in all axis at once. But you can lock its axis by using the objects own axis. Like I used the trees axis for Y, that locked Y.

EDIT: When you point at an object, if you want to add diagonal points you rotate the box with the axis rotation. Then when you move the box it moves diagonally.

MadBit
VIP Member
Gold Codemaster
17
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 29th Apr 2012 20:31
I think Sasuke means this. Below the executable.


With Computers you can solve Problems that you have never befor.
Share your knowledge. It's a way to achieve immortality. (Tenzin Gyatso)
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Apr 2012 20:41
I can't run it, I don't have xrot

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 29th Apr 2012 21:02
I don't have xrot, I can run it.

«It's the Shader, shader me this, shader me that»
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Apr 2012 21:44
Quote: "I don't have xrot, I can run it."


You have extended rotation else this wouldn't work...

`initialize eXtendet rotation
XROT INITIALIZE

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 01:02 Edited at: 30th Apr 2012 01:03
Thank god. Someone got what I was saying

Just run the exe in the attachment to see it.

Note: I was just writing a DBP version using my own matrix class.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 02:33 Edited at: 30th Apr 2012 02:47
Well that was the first example that I posted way back on page 2.



How are we supposed to get what you mean if we have already posted it?

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 02:49
Hahahahah... That's was a joke right. Cause that's not even near close


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 02:52 Edited at: 30th Apr 2012 02:56
It's the same. Just change the box to a tube. You can switch the positions of what you are looking at to where you are looking from. Obviously though it is the same.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 03:41
Quote: "It's the same. Just change the box to a tube. You can switch the positions of what you are looking at to where you are looking from. Obviously though it is the same."


Well if you say it's the same make it the same then to prove your point. Cause so far you've supplied no evidence of it being the same.


Join or Support!
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 30th Apr 2012 04:44
What... They're not even remotely similar... You can't accomplish this with "point object" and the free-flight commands alone: point object rotates around the Y-axis, so to get it to effectively rotate about a different axis you would have to somehow untransform the vector to the camera by the difference in the axis of rotation you need, and then at the end transform everything back again... That requires even more matrix algebra than Sasuke's method.

[b]
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 08:07
Quote: "They're not even remotely similar"


Thank god. Diggsey to the rescue.

Quote: "That requires even more matrix algebra than Sasuke's method."


What I said earlier "I was just writing a DBP version using my own matrix class." Code up later today.


Join or Support!
MadBit
VIP Member
Gold Codemaster
17
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Apr 2012 08:29 Edited at: 30th Apr 2012 08:41
Yes. Or you can use my eXtendet rotation plugin.

With Computers you can solve Problems that you have never befor.
Share your knowledge. It's a way to achieve immortality. (Tenzin Gyatso)
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 08:50
That us a really neat plugin btw MadBit. Out of interest, what's the difference between an Object Matrix and a Rotation Matrix? Also whats is actually going on behind the scenes of Xrot Rotate To?


Join or Support!
MadBit
VIP Member
Gold Codemaster
17
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Apr 2012 10:21
Quote: "Out of interest, what's the difference between an Object Matrix and a Rotation Matrix?"

Object Matrix is the whole matrix includet rotation, translation and scale. The rotation matrix is only the rotation komponent, in this case the translation is (0,0,0) and scale is (1,1,1).

Quote: "Also whats is actually going on behind the scenes of Xrot Rotate To?"

this is nearly the same as in point object. With the difference that you choose yourself the axis and the maximum angle to rotate. It transform the given vector (up = 0,1,0, look = 0,0,1, right = 1,0,0) to the given point.

With Computers you can solve Problems that you have never befor.
Share your knowledge. It's a way to achieve immortality. (Tenzin Gyatso)
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 30th Apr 2012 10:53
Previous post like from past, thread goes into GroundHog's Day

«It's the Shader, shader me this, shader me that»
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 17:55
You set your model to use the pivot point that you want. I thought that this thread was for a game. If it's for new DBPro commands to move the pivot point then that might be good. But my program still works if you move the pivot point. Here is the same code again using the new pivot point....

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 18:56
Again. Not the same.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 19:02 Edited at: 30th Apr 2012 19:09
Quote: "Again. Not the same."


What's the difference? That's a lazer now like you said.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 19:25
You need to orient the laser/beam (which are usually quads since it's a particle effect) towards both the camera and the direction the laser is moving.

But what you've done is totally remove the need for this cause you turned the laser into a tube meaning you don't even need to rotate it to face the camera. But it also proves that it can't be done since if you could you would of kept it a quad and not used something that doesn't required camera facing.

If you want to make it the same. Use a plain/quad and not a cylinder.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 19:39
Where does that come into the thread title?

Quote: "A command like Point Object, but with Up Vector."


Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 19:49 Edited at: 30th Apr 2012 19:50
Quote: "A command like Point Object, but with Up Vector."


Doesn't exist. But something that's exactly like that is rotation about an arbitary axis. Exactly what I'm talking about.

MadBit's code early on using his plugin was the solution to this. I'm trying to make the DBP equivalent.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 19:55 Edited at: 30th Apr 2012 19:56
I can see that it's more difficult now, but still say that plains were not mentioned in the thread at the beginning. I was just trying to make a game work, not to make something flat.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 20:13 Edited at: 30th Apr 2012 20:14
Ah got ya. Well it's easiest to show arbitary axis rotation on a quad cause you can easily see if the object is pointing correctly. Since arbitrary axis rotation is mostly seen for particle effects in games, I thought it best to play on that.

Not going to lie. The math isn't fun. It's easy to create a matrix and whatever but getting it back to eular isn't. Euler rotation sucks.

If I remember correctly, one of Lower Logics functions can do this. Here's the incredibly useful function set:



Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 20:36 Edited at: 30th Apr 2012 20:37
Hmmm makes me wonder if it is faster just to use a 3D object though. I mean that so much maths might actually be slower than the cylinder that I used.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Apr 2012 20:58
Only issue is a cylinder looks terrible up close and it's would lose it's effectiveness. Also it has far more ploys than a quad and math isn't that slow... Well in DBP I guess it is cause thing that should be native aren't so we have to make so many workaround to get there. Guess you just don't go mad on using it that often.


Join or Support!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 22:06 Edited at: 30th Apr 2012 22:06
I think it looks OK. Decided just to finish this as a demo of the 3D version just in-case it does turn out faster.

Download if you prefer a 3D version...

Login to post a reply

Server time is: 2026-07-07 22:23:20
Your offset time is: 2026-07-07 22:23:20