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 / Scale Vector3 and sphere

Author
Message
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 8th Aug 2010 09:08
Okay so here's what I'm doing.

I make a planet *poof* and then at the center of the sphere, I place a gravity constant on three axis'.

Now I make some 'particles' that raise and lower from the planets surface to the appropriate position based on kinetic energy (temperature) caused by collisions from other particles. If there are lots of collisions within a certain amount of time, the average temp of the number of particles that collided within that amount of time is displayed back to the user.

What I need to do is scale the particles from 0,0,0 (or the objects center + Radius) to the correct position on/above the planets surface. Since this is primarily a spherical object, I am guessing I could use vectors and scale them out to the appropriate location. Can someone help show me how I could do this. I just need a variable scaled out based on temp which can be ((simulated)) raised or lowered by a key (Like Upkey() and DownKey()) This scaled location would be the location in which a particle object or another type of object would be positioned.

-Just ask if you need more info

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 8th Aug 2010 11:15
From what I think you're saying... i don't think you really get what you're doing... You're trying to tie together spherical coordinates, gravity, and temperature... none of which relate to each other too much. If these particles raise and lower from the center of the object based on their kinetic energy, that's a chart. If they collide with each other, and the temperature is based on the number of collisions, that's a simulation. The gravity is just kinda there, and I don't think it makes much of a difference. A constant gravity would mean everything falls in the same direction, not towards the center of a sphere.

So... What I'm guessing you want to do, is have particles with totally elastic collisions being attracted to the center of a sphere, and then track the number of collisions. Something like this:

where the arrows on each particle are its direction, and everything is being attracted to the center?

I'd suggest reading up on elastic collision and vectors. You really don't need spherical coordinates.


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?
Four Dimensional
18
Years of Service
User Offline
Joined: 11th Jun 2008
Location: lost in thought
Posted: 8th Aug 2010 11:23
I'm not fully comprehending the goal, but it seems you wish to place a particle emitter relative to a sphere's center and move it closer or farther.

Based on this assumption, you need to begin with a simple vector that points to the emitter from the planet's center, then normalize it. This will make the length 1. Now, you can multiply by a value which will serve as a distance.

For example:
null = make vector3(vec)
set vector3 vec, x, y, z
normalize vector3 vec, vec
scale vector3 vec, vec, distance

There are also ways to rotate the vector about the planet's center, but I'll wait for feedback first.

Hope this helps

Imagine this: there may exist infinite parallel universes, all similar to ours, but we may never be able to encounter or even interact with them.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 8th Aug 2010 12:18 Edited at: 10th Aug 2010 03:53
2nd reply got it - (and the first came across kind of mean ) lol. and as I understand - Gravity, spheres and temp seem (at least to me) to be a set of fundamental principals as noted by astrologists and cosmologists. But to refrain from being a butt head, the gravity I am speaking of is relative to the objects (sphere) mass - which in turn denotes its size and the total number of particles which make up an atmosphere. Since gravity has somewhat of a scale-off when speaking of fields and planets, scaling the gravity out in all directions down to 0 from "X" amount would kind of yield a falloff effect for particles, which rely on a gravitational variable therein multiplied for the latter calculation of particle attraction to one another, varied by mass. The temp of the particles is based on particle collisions ONLY - radiant heat from the planet can be added but I'm not there yet - you're illustration provides a simple version of what I am trying to do - minus the fluid dynamics that cooling and rising temperatures have or the current-like fluctuations that occur on earth due to a tilted axis and then there's the matter of pressure(s) and liquid to gas conversions and vise-versa - but, I digress.

I believe that when a particle rises on earth - to us it may go straight up (minus the influence of air currents) so to gather that the "straight up" approach would give us a line from the sphere's center (+ the radius) to the final position of the particle before falling again, all I am trying to do is gather how to scale up in a spherical sense... like in the form of a 3d spherical emitter who's particles move based on kinetic energy and not speed.

Since I believe velocity=((Pos1-Pos2)*(Mass1+Mass2))*Gravity, the same approach can be done for all three axis', and that collisions between particles will yield a major variation to the rules of areo-dynamic partilces (gas) - but for now, all I am looking for is the scaling detail... and I will try what 4D suggested.

Lets see what this gives me.

EDIT-
Works fine - I just add the radius of the sphere and walla! Only bit of trouble I have is the area in which the particle(s) spread to... but I can figure that out. Thank You!!!

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.

Login to post a reply

Server time is: 2026-07-24 20:35:48
Your offset time is: 2026-07-24 20:35:48