Miles Mathis' Charge Field
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Virtual Scattering Application

4 posters

Page 1 of 4 1, 2, 3, 4  Next

Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Thu May 23, 2019 9:05 pm

I just made some commits using Fork, and it has 2 fields for text when you commit. SourceTree only has 1. One field has the placeholder text 'Enter commit subject' and the other has 'Commit description'. It turns out that the UI will only show the 'Enter commit subject' text in the graph, which is useless. I suggest you don't use the 'Commit description' and only use the 'Enter commit subject' text field. That will keep it consistent with SourceTree.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Fri May 24, 2019 6:59 pm

.
I briefly looked at the latest and didn't see any animation.

SSH Keys. SourceTree wouldn’t let me load/recognize the new ssh key I made yesterday, so I used SourceTree’s PuTTY key generator to make a new RSA key. I made “copies” of the public and private keys.

I logged into BitBucket, went to settings: SSH keys, and pressed ADD KEY. I labeled the key and pasted the public key into the designated area.

To see if anything changed, I did a Fetch (without the terminal). I received the usual output:

Code:
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch origin
fatal: ArgumentException encountered.
   An item with the same key has already been added.
.
.
.
fatal: ArgumentException encountered.
   An item with the same key has already been added.
remote: Invalid username or password
fatal: Authentication failed for 'https://McBride_Robert@bitbucket.org/Nevyn2k/scattering.git/'
Completed with errors, see above.

So I’m still in limbo. What next? Now that I’ve got the new ssh keys installed how do I implement them and restore my good graces with SourceTree? I believe I need to clone the .git repository next. And throw out the one I'm using? Does that sound correct?

P.S. Interesting, I see my repositories at BitBucket are gone. I guess I must clone the .git repo. That is, if I can find it. I did a search on scattering that came up empty. I'll look for the BitBucket e-mail invite next.

I cloned scattering.git using SourceTree, and SourceTree denied the ssh key. Would I like to try again? I entered the public and private copies of the keys I'd mentioned earlier. SourceTree accepted the keys, and URL . Scattering appeared in a second tab.

Please excuse the play-by-play. I think I'm good. I'll let you know if I see any indications otherwise.
.


Last edited by LongtimeAirman on Fri May 24, 2019 7:47 pm; edited 2 times in total (Reason for editing : Added more to the P.S.)

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Fri May 24, 2019 10:02 pm

I moved the animator over to the SimpleGunGenerator class, so you need to use that to see it.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sat May 25, 2019 11:04 am

.
The color change animation makes a big difference.

////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\

Virtual Scattering Application - Page 2 Fstatu10
I thought I succeeded in installing ssh keys yesterday, but my latest SourceTree Fetch results show otherwise. The direct Fetch request results are on the left and the terminal Fetch request output is on the right. I deleted all other repository tracking on SourceTree except the latest scattering.

When I launch Fork, it does an auto Fetch. I see more than a dozen new commits you've made since yesterday. Why did the Fork Fetch work? Is it still connected to the https scattering repo? I’m afraid to Pull anything at this time.

What next? SourceTree recommends creating another ssh key set or reloading the current one. If/when I create another PuTTY generated ssh key set, do I need to go into BitBucket to load the new public key or does sourceTree do that? I suppose I also need to load the public and private keys in Fork.

I'm much more comfortable with ssh Key addition/actions. Any ideas?

BitBucket confirmation. Failed to mention I received a bitBucket e-mail notification 17 hours ago, including the public key. I suppose I might forward that to you?

Dang, I see from the terminal output I allowed SourceTree to create a new repo location in my Documents folder instead of the Git folder. Does that make a difference?
.


Last edited by LongtimeAirman on Sat May 25, 2019 12:08 pm; edited 2 times in total (Reason for editing : Added new repo location?)

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat May 25, 2019 5:48 pm

IF you create a new key, then you absolutely need to tell the BitBucket website about it. You shouldn't have to create a new one unless there is a problem with the existing one.

The location of the repo doesn't really matter, but you can just clone again where you want it.

Sounds like you should just use Fork then. If that actually works, then use it. The main thing I didn't like about fork was the interface layout, but SourceTree has now gone and done the same layout. Fork doesn't seem to have many options around authentication. It doesn't seem to save passwords.

Make sure that you are using the correct BitBucket account. Only 1 has access to my repo, so if you happen to login as a different account, it will fail.

In SourceTree, you could try removing all of the saved passwords (Tools->Options->Authentication->Git Saved Passwords) and enter them in again when it prompts you. Maybe some of them are bad. It seems to save about 5 variations of them for some reason.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sun May 26, 2019 11:03 am

.
Virtual Scattering Application - Page 2 Xkcdhu10
From https://www.xkcd.com/627/

Thanks for the continued support and direction, I’m sure my insecurities have tried your patience. Over the last few days I’ve reviewed many git related videos and instructions, and impressed the heck out of my local support team. So much so they shared their secret logic flow diagram which I’ve included above. I acknowledge that switching to ssh keys is a big improvement. Re-entering my public and private keys when I open SourceTree is a small price to pay for an actual working git/bitbuckt interface.

Virtual Scattering Application - Page 2 Theran10
Here's what 'the range' currently looks like - Super high tech. The solar panels making up the floor and ceiling would also make perfect detectors.

After my two-day break, I'm back to work. I see you’ve made forty or so commits. That’s a lot of changes. The Scattering program now has about 22 support files. Please consider fleshing out the read me file or some other document showing the program flow as in the diagram above.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sun May 26, 2019 6:48 pm

I really like that hexagon texture. There is another one that will work well, but I can't get it yet. The solar cells would definitely work as detectors, but it was all I had to match the hexagons and give it that scientific, futuristic look. I have my eye on some sci-fi panels that might be able to work as the floor and ceiling so that I can free up the solar-cells for the detectors.

While I have made a lot of commits over the last few days, it is really just small parts of a larger piece. I have extracted parts out into their own JS files to keep the file maintainable. I get sick of scrolling from the bottom to the top and back again in a file that is 1000 lines long. It seems I spend most of my time looking for things instead of working on them.

I have been fleshing out the way models are created and trying to find a nice way to do it all. I'm working on a BatteryGenerator that will make use of the spherical point algorithms to place the guns. This causes changes in the RangeGenerators and GunGenerators, which sit on either side of the BatteryGenerator.

I have introduced another level of abstraction around textures. The first was the TexturePack, which is designed to store related textures that work together to create a single Material. Now I have introduced the TextureDef, which is used to store related TexturePacks based on their resolution. So a single TextureDef might contain 3 TexturePacks, where the packs are 512, 1024 and 2048 in resolution. You only use one of those packs though, not all of them. Well, you could use any number of them if that is what you want, but in general they will only be used to retrieve a single Material at a given resolution. This allows the app, or a model, to decide what resolution it wants to use and the appropriate textures will be applied to the models. While everything looks great with hi-def textures, they take time to download. A single TexturePack at 2048 res can easily require above 10MB, and that's just a single Material.

If you look at the js/scaterring-range-gen.js file, and find the SphericalRangeGenerator, then find the getTextureDefs method of that class, you will see a lot of commented out lines. You can change the textures being used by uncommenting out what you want to use, and commenting out the existing version of it. For example, the main one I change to test the textures is the sphere material. It is currently using the hexagons for the sphere texture, but you could comment that out and uncomment one of the other sphere ones to see what they look like. Some textures don't work as good when applied as a single texture across the complete sphere. They might require wrapping the texture so that it is used many times across the sphere. You can play with those settings in the SphericalRangeGenerator constructor where it declares a sphere object that has these settings.

I must admit that I have been having too much fun playing with textures and models, and not spending enough time on the actual purpose of the app. I'll get to that. Eventually. I swear.

I will see what I can do about an architecture diagram, or at least a decent description. I might be able to create a process flow diagram for some of the processes, but not all. Things change too quick for that, but the way everything is created should be feasible. Showing who is responsible for what.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Mon May 27, 2019 9:49 am

.
Nevyn wrote. Try to use math to determine the radii and thickness of the tubes, rather than set values. Let the user (of the class, not the app) set the min and max, and let the math calculate the rest. But get it working anyway you can first, ...
Virtual Scattering Application - Page 2 Rgs210
Using the any way possible rule, we’ve got a set of Ring guns. I’ll try to algorithimize (?) simplify their construction next. It uses the same shared material as the simple gun but they aren't color animated yet. I’m surprised the muzzle is essential, so I’ll need to change the muzzle's shape.
Virtual Scattering Application - Page 2 Rgs310
I'll point out a small error. The top view (actually from the side (+/-x or +/-z)) shows that photons emitted by the far gun – toward the viewer - have a small random up/down or side to side component in their forward velocities - that's good. The second image, (a top or bottom view (+/-y)) shows all the photons approaching the viewer are in a horizontal plane passing through zero. Either the x or z random component is gone and needs to be included.

I reviewed all the sphere mats, I'd like to try and make some small changes to a few. I noticed the outdoor range beside a tree just before I Pushed my RingGun changes. Quite nice.

I see I overwrote at least one of your latest changes - probably the tree. I'll try putting them back in without deleting my latest.
.


Last edited by LongtimeAirman on Mon May 27, 2019 10:14 am; edited 1 time in total (Reason for editing : Added a new final sentence.)

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Mon May 27, 2019 10:56 am

.
Virtual Scattering Application - Page 2 Unommi10
Where would I be but for the screw-ups? I realized my latest changes had deleted the wonderful outdoor range. So I attempted to revert my push and remove the specific hunks deleting your latest changes from my commit staging area. Well that made a mess, uncommitted changes and the creation of a diff doc, scattering-range-gen.js.rej.

Help! Once again your assistance is requested. What's the graceful out here? How should I remove my latest uncommitted changes? Can I delete the diff doc?
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Mon May 27, 2019 7:15 pm

It looks like you have reverted the changes correctly. It still thinks that scattering-range-gen.js needs to remove my changes though. Do you have any required changes in that file? If not, then just discard your changes, then you can delete that .js.rej file. Definitely do not commit that .rej file, it is an artifact of Fork when it finds a conflict and needs you to merge the changes together manually.

My guess is that you had started to make changes, then pulled some of my changes (without selecting the rebase options on pull), so it assumed that your changes overruled my changes.

Here is how it should have happened:

You do some work.
You may commit your changes (but not push them).
You do a fetch and see that there are new commits.
You do a pull with rebase.
You push your changes.

The pull with rebase option tells the app to pull those changes, and then alter your changes so that they sit on top of those that have just been pulled. Then you are safe to push your changes. Effectively, it inserts the pulled changes into your changes, if it can. There-by making your file the same as if you had pulled those changes before you started working on it.

I sometimes forget to fetch before pushing too, but it's starting to become a habit.

That error in the gun accuracy is not an error, it is randomness. The accuracy setting for every gun is randomized between 0 and 1. I guess you got lucky and the gun was very accurate. The accuracy is applied using spherical coordinates, and both the inclination and azimuth are randomized individually.

Then again, maybe there is an error. Since it uses spherical coords, there are limits to the angles in those coords. The code is not checking for angles over 360° and then reducing them to be 0° <= a < 360°. I'm not sure if that is even required, because 361° works out to the same position as 1° anyway.

If that is the case, then certain gun directions will cause the error, and others won't. The Y dimension is susceptible. So is either the X or Z, but only one of them and I can't remember which one. I think it may be the Z dimension. See if you can see a pattern to the error.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Mon May 27, 2019 7:27 pm

I like the rings. Don't like the barrel on it though. You don't need a barrel, or a muzzle, but you do need a muzzle position. To be clear, you don't need anything in your model that is a muzzle, but you do need to specify the position of the muzzle because that is where the bullets starts from and then move in the gun direction. For a ring based gun, I would like the muzzle position to be at the back so that the bullets travel through the rings and out the front. But I have just realised that won't work because the muzzle position is used to determine the direction of the model. It is assumed to be at the front of the gun. I can fix that.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Tue May 28, 2019 4:12 pm

.
Nevyn wrote.
Virtual Scattering Application - Page 2 Gitins10
I taped it up alongside my new tech support logic flow diagram.

Virtual Scattering Application - Page 2 Norran10
Here’s a glimpse of the Norwegian forest scene, along with the latest RingGun image - Honey Bee Hives. I was sure I saw a collision between a particle and the target, but was too slow to capture it. The animation color changes, extra wrapping and additional segments give the appearance of gold or Snakeskin. I replaced the fixed individual ring locations with variables and distance formulas. One can now easily mess with the ring-gun’s axial and radial numbers such that they may, for example, overlap. Above, the axial length is ‘two’; in the image below, we see the center with the overlapped ends of six each eight axial units long ring-guns. I can imagine creating waveform actions by expanding/contracting the individual rings accordingly. Or pulse the color animation waveforms at different rates. The rings are versatile and provocative.
Virtual Scattering Application - Page 2 Overla10
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Tue May 28, 2019 10:22 pm

I have a WaveAnimator class that is doing the pulsing of colors. It has an offset property that I want to test on your ring gun, since it has the individual rings to do so. I want to attach an animator to each ring, so they will need their own Material (not shared), and then set the animator offset so that the rings pulse from back to front. I didn't want to complicate the code you are working with, though, so I haven't done it yet.

I just pushed some changes and one of them changes your ring gun code. It produces the same results, but I wanted to show you how to create and place the meshes in a for loop. I didn't want to step on your toes, but I thought this was worth pointing out. Whenever you have multiple things that are basically the same, you should use a loop. It can be tricky figuring out how to do some things in a loop, but there is always some way to do it.

As an exercise, you can do the same thing when creating the geometry. The materials should be even easier. You should be able to create the geometry and material in the same for loop (not the same loop creating the meshes, but a new loop in the init method).
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Tue May 28, 2019 10:44 pm

If you can get the geometry and material being created in a loop, then try to refactor it so that you can vary the number of rings. A property on the generator, such as this.ringCount, could be used to control it and the code spaces them appropriately. This may mean that the rings overlap, but it is up to the user of the generator to give it meaningful values.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Wed May 29, 2019 12:17 am

Sorry, I couldn't help myself. I implemented a pulse-wave system on the Ring Gun.

An image doesn't do it justice, but here it is:

Virtual Scattering Application - Page 2 Scatte16
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Wed May 29, 2019 5:45 pm

.
Virtual Scattering Application - Page 2 Slime10
Like Dr. Who’s Tardis; every time I look, we’re somewhere else. Here we are surrounding by blue slime.  The target zone has a little glare – but look, we have collisions. Many collisions. Note the red photon approaching the bottom center of the image or the photon at top left corner - well outside the photon streams.

Progress, and great directions Nevyn.

I for-looped the ring gun’s geometry and material, but not before noticing that var factors = [ 0.9, 1 ] works like magic. And var geom = this.geometry['cRingPlus' + (i+1)]; turns a name into an indexed array. I'd wanted to turn the long list of geometry parts into a loop but couldn’t see how. Seeing your solution, wow, such ideas had never occurred to me.

As you suggested this.ringCount is now a variable. This enables the 25 rings in each ring gun shown - too many to see in this image. The color animation wave pulse is enhanced.

I still owe you a gun or two.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Wed May 29, 2019 7:20 pm

I'm building a texture library, so I keep changing them to see how they look. Some work better than others. For example, I really like the scifi panels and flooring, but they hide the bullets too much. I have to remind myself that it is no good if it looks great, but we can't see the main point to the app.

Using loops can be difficult until you work through a few and get a feel for how to make them work the way you want them to. It usually means creating some data structure(s) that allows you to retrieve the data you want in a looping fashion. Other times you just need to work out how to use the loop to perform some math. Try to figure out how to use the incremental variable to your advantage. Also, the incremental variable does not need to increment by 1. You can increment by whatever value you want, even negative values.

The statement: this.geometry['cRingPlus' + (i+1)]; doesn't turn it into an indexed array, it is just treating an object as if it were an array. You see, in Javascript, all objects, even arrays themselves, are just maps of keys to values. An array just happens to use integers as keys (although they are actually converted into strings internally). You can actually have what is called a Sparse Array in JS just by only using certain indexes. They don't need to start at 0 and increase by 1. So this is valid:

Code:

var array = [];
array[10] = 'Ten';
array[1001] = 'Big number';

So we can references items in an object like it is an array. Sometimes, we actually have to do that because the keys are not valid JS identifiers.

Code:

var ob = {
  one: 'One',
  'invalid-identifier': 'still works'
};
// we can reference the first as:
console.log( 'one: ' + ob.one );
// or we could reference it like this:
console.log( 'one: ' + ob['one'] );
// but we can't reference the second like this:
console.log( 'invalid-reference: ' + ob.invalid-reference );
// JS will interpret that as ob.invalid minus reference
// but we can still reference it like this:
console.log( 'invalid-reference: ' + ob['invalid-reference'] );

So in this case, I was using that to build the keys used in the materials object, since I can treat them as strings and not identifiers.

Tricks of the Trade.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Wed May 29, 2019 9:56 pm

.
I'm not complaining; I like textures, I'd be fine with a random default setting for the start. I can't think of a better opportunity to learn about textures, materials, etc.

By the way, I came across this instruction.
Code:

this.ModelGenerator.init.call( this );
 // TODO create geometry objects and store in this.geometry using a suitable key
 // example: this.geometry.barrel = new THREE.CylinderGeometry( 5, 2, 7 );
 //this.geometry.sphere = new THREE.SphereGeometry( this.bodyRadius, 32, 32 );

Sometimes things click, most times not so much. Your last post and this request for a suitable key sound related. It still doesn't make sense to me. I'm afraid I might relegate this problem to my toDo list. Like the possible random bullet velocity/direction problem - for that I suppose I should start looking in scatter.js?

Would you care to expand your request/statement a bit?

Please feel free to task or redirect me as you will. I don't ever consider your changes and additions as stepping on my toes.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Wed May 29, 2019 11:46 pm

You're already doing that. This is from RingGunGenerator.init:

Code:

...
this.geometry.centerRing = new THREE.TorusBufferGeometry( cRingRadius, cRingTubeRadius, tubes, radials, Math.PI * 2 );
this.material.centerRing = this.createBodyMaterial();
...

It isn't related to my last post, where I was just discussing programming techniques, nothing specific about this project. I just wanted to show how to use strings to retrieve values from objects because it is so useful.

Speaking of this.geometry and this.material, there are some objects being created in RingGunGenerator that are not needed. They were from the original SimpleGunGenerator. Try to identify them and remove them.

The bullet accuracy problem is a bit tricky because it revolves around spherical coordinates. If you want to have a look, it is in scattering-gun.js, lines 131 to 138 (at the moment).
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Jared Magneson Thu May 30, 2019 12:13 am

Really cool stuff to be building into an app! Keep going, guys.

Jared Magneson

Posts : 525
Join date : 2016-10-11

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Thu May 30, 2019 2:12 pm

.
Hey Jared, thanks. Nevyn is a wizard. I’m hoping he'll provide some physical details to account for all the collisions. Separate subject, can’t help but mention I saw you and Ollie at Cutting Through the Fog, exchanging recent theoretical claims concerning planetary conjunctions and pyramid power; and Miles’ response. HuAhh.

Random trajectory testing. I used scattering.html lines 253-255 camera.positions.x, y or z to set the app viewpoint. Comment out two of the three component positions, leaving only the x, y or z ( include + or - ) distance in order to conveniently view each gun’s boresight direction. The misses are clear enough – there’s no need to turn off collisions.

scattering-guns.js lines 135-143. Comments have been added to the code.  
With s.inclination only (s.azimuth commented out) all viewpoints show a random component – sometimes just a small amount, yet nevertheless always present, in a single plane passing through the perfect bullet firing direction.

With s.azimuth alone (s.inclination commented out), all viewpoints except the top and bottom show a random contribution. There are no random contributions to the +/-y top and bottom gun firing trajectories. Perfect bore shots every time.

In summary s.azimuth is not working for +/-y shots. At present I have no idea how to fix it, especially given the fact that there will likely be new configurations soon.  
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Thu May 30, 2019 7:29 pm

I fixed that accuracy issue. It was caused by the limitations of the spherical coordinate system, where the inclination is a value between 0 and PI. The azimuth can be wrapped, it doesn't matter if we use 720° or -10°. The inclination does care though. So when the gun was on the Y Axis, it could not apply the accuracy changes to the inclination correctly.

To get around that, I use a set direction that I know is safe (so not near the zero points in either inclination or azimuth) and calculate the accuracy changes on that. I convert that back into a vector and then calculate the required axis and rotation to put that known direction (with slight changes) into the actual direction of the gun.

A lesson in knowing your tools. If you ignore the limitations of your math, it will give you invalid results. Math doesn't care about correct or incorrect, right or wrong, good or evil. It only calculates. If you give it bad data, it will happily give you bad results.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Thu May 30, 2019 9:11 pm

.
Virtual Scattering Application - Page 2 Revxbe10
Lessons learned and appreciated. I briefly considered using a 'good angle', for when the gun is on the +/-y axis. I believe the same thing is necessary when using Euler angles, but I've never looked at that problem and am not familiar with any details. This experience is a good example to draw from.

Forgive me for pointing out - good thing we aren't using real beam guns yet, the +X gun is firing backwards. I'd race you to fix it, but am afraid I'd cause an accident.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Thu May 30, 2019 10:44 pm

Fixed that. It is caused by trying to find the axis to rotate around, but the vectors are in opposite directions.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Fri May 31, 2019 4:16 am

I improved the collision detection system. It still looks like they collide too soon, but it is really just a visual discrepancy between the size of the particles bphoton, and the bullets which are sized in the shader.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Fri May 31, 2019 9:38 pm

.
Virtual Scattering Application - Page 2 Helicp10
I’m trying to create another gun, this time based on a helix. Call it a Helical rail gun. Like an old-time barbershop pole, several helixes arranged in a circle form a tube cylinder – viewed down the barrel, each helix starts at the next consecutive angle. Color animation may give the old-time barber shop gun a powered or different kind of spinning appearance.

I googled helix and three.js and found the basic directions:
1. create an array of points that describe the helix (check wikipedia for the formulae)
2. create a curve from points ( THREE.CatmullRomCurve3(points) )
3. If you want a circular cross section use THREE.TubeGeometry and pass it your curve
4. if you want a non circular cross section, create a new THREE.Shape with the cross section
5. use THREE.ExtrudeGeometry and pass your shape and curve to it just a guess hope it helps

Another discussion involved a thin ribbon box that gets regular bends.
https://discourse.threejs.org/t/solved-creating-a-helical-sweep-with-a-flat-profile/3163/8
It contained one particular solution mentioning DNA that got most of my attention.
Jun '18 looeee wrote I made a DNA pen a while back, here it is in case it’s useful to you.
Your double helix sounds quite a bit like DNA, so you could use a helix function to generate the upper and lower points and then create the geometry from those.
I began by copying SimpleGun into a new HelixRailGun. I’m in the middle of converting the various parts of the DNA javascript pen into the module.HelixRailGunGenerator. The App is running without errors – but also without a helix. I don’t know enough to conform it. Instead of var, the js code uses const. All the steps have been converted into functions that I don’t believe I can call across the various HelixRailGunGenerator module sections.

I'll regroup with simpler code, studying the instructions you gave me last week ago when I began ring gun.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 01, 2019 12:16 am

Do everything in the createModel method. When it is working, then you will be able to see how to pull certain bits out and into other areas of the code.

The image you have above is a perfect texture to place over a simple cylinder geometry. You then make the cylinder spin about its long axis. That will make the stripes rotate around and appear to move along the surface. Much simpler than trying to get geometry to do what you want. Also a lot less expensive to render.

If you want separation between the spirals then you have to use individual geometries. Creating curves for TubeBufferGeometry is a good approach. You just need to understand the THREE.Curve class and implement one.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sat Jun 01, 2019 2:24 pm

.
Virtual Scattering Application - Page 2 Ribbon10
We have spinning – sorry, they aren’t animated yet, to me they just appear to be spinning - ribbons. The first part to a new helix rail gun. It doesn’t like the honeycomb texture yet, I guess that’s because this.cBM uses cylinder material and geometry while this.ribbon is a thin box material? I'll try replacing each ribbon with a set of ribbons next.

More progress - needs a little adjustment. As we can see, instead of just the six cardinal directions +/-x,+/-y,+/-z Nevyn's created a fourteen gun range configuration. I can look down each ribbon’s boresight. Only the six cardinal positions (along each axis) are correctly oriented toward the center target. The four mid latitude group above the ‘equator’ are all targeted almost horizontally to some positive y value on the central +/-y axis – l'm guessing (0,10,0) - and NOT toward the central target. The four mid lat group of ribbons below the equator are all targeted at the same erroneous point as the top mid lat group, again NOT toward the central target. Little adjustments.

P.S. My cylinder texture question was incorrect. I was loading the wrong texture. // corrected
.


Last edited by LongtimeAirman on Sat Jun 01, 2019 3:12 pm; edited 1 time in total (Reason for editing : Added P.S.)

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 01, 2019 7:52 pm

I've spent hours trying to fix those alignment issues, but I just can't find it. The weird thing is that I can get the guns shooting in the right direction, with perfect accuracy setting, but they won't rotate the model into the correct orientation. Damn annoying.

Good work on the ribbons. Did you still plan to try the TubeGeometry method? I must confess, I've already done so. Created a few new animation tricks to work with it too. I put a texture on the tubes that makes it look like red hot metal. Then I made the texture move along the tube so it looks like it is flowing liquid metal.

Virtual Scattering Application - Page 2 Scatte17

Don't let that stop you though. Working with geometry is a valuable skill.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 01, 2019 8:02 pm

The reason it failed when using the cylinder material is that they actually use 2 materials, one for the radial part and another for the ends. So you actually had an array of Material objects, not a single Material.

Note, cylinders don't have to use 2 materials, that it just the way I setup the createCylinderMaterial function as I was using it to create the barrel.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sat Jun 01, 2019 10:39 pm

.
Virtual Scattering Application - Page 2 Threer10
Three ribbons to each Helix gun. Playing with the numbers.  

I do enjoy working with geometry, it's the materials and meshes that really complicate things. Textures are over the top. Asking me to come up with a gun or two was very kind of you - I do want to make an appropriate effort. Things are getting complicated around here, I know I must be missing some of your changes. Can't wait to see the lava helixes and mess with them.

The 14 gun orientation problem seems much the same as the quaternion algorithm you gave me to reorient spherical surface particles from world coordinates to the center of the configuration.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 01, 2019 11:41 pm

Looking good. How are you going to apply it to a gun model?

I love playing with geometry. Creating it is fun too, complicated and stressful, but when you get it to work it feels great.

Geometry, materials, and meshes are the joining of 3 worlds.

The geometry represents form. It contains the vertices (and normals, colors, texture coordinates) that define something. It can be interpreted in many different ways. For example, you might create some geometry that represents a box. It can be interpreted as a box with surfaces, etc, or it can be interpreted as lines and it will be rendered as wireframe. We could even interpret it as just points and only see a dot per vertex.

The material represents what it looks like. In Java3D this is called the Appearance, and that name gives you a better idea of what it is doing. Material works though, as it is this object that specifies color and texture and a heap of other things that control the rendering process. They control exactly how the geometry is interpreted and processed to draw something.

This separation of geometry and appearance gives us great power to manipulate things and create a versatile universe, while reducing the amount of data that has to exist and be transferred between RAM and the GPU.

Which brings us to the mesh. This represents existence in the universe. The geometry is a possible existence. It is the form of that which might exist. It is just the blueprints. The material is a possible appearance. It is the look that it might have. The mesh brings them both together and actually defines an object in the world being created.

Since a mesh has a geometry, and it has a material, those things can be shared with other meshes. We can have 1000 meshes using the same geometry and material and the only things that get transferred to the GPU are 1 geometry and 1 material (actually, a material becomes a shader program, but it's still on the GPU and has to be compiled, so it has cost).

Since we can share, we can also update shared objects and all meshes using them will be updated. 3D graphics programming is really about doing the most in the least. It takes too much time to update 1000 materials to change the color, so we share 1 material 1000 times and just update it once.

Materials are confusing though. I'm still figuring out a lot of it myself. This project has become my play ground for it. I'm trying things I haven't done before just to see what happens and how I might use it to my advantage. That's why I do this stuff.

You aren't missing my changes. I put them on a separate branch as I didn't want to interfere with your own efforts in the same area.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sun Jun 02, 2019 1:19 am

I merged my branch back on to master and pushed the changes.

Virtual Scattering Application - Page 2 Scatte18
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sun Jun 02, 2019 5:56 pm

.
Virtual Scattering Application - Page 2 12hrva10
I’ve been cleaning up the Helix gun. It’s now ‘for looped’ with spinning color animation, and accepts from 1 to a large number of ribbons. Each ribbon has a long thin rectangular cross section which is orthogonal to the boresight that helps distinguish it from the newer, flashier, and more colorful Spiral gun. Spiral gun has a rotation animation which should also work with Helix, ... .
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Mon Jun 03, 2019 4:19 am

I like the turbine look of that up close. Maybe you could limit the ribbon length to create some fan blades. Give them a rotation and fit a gun around it.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Mon Jun 03, 2019 7:51 pm

.
Virtual Scattering Application - Page 2 Spinni10
It took some time, and it’s hard to tell, but these four ribbon blade Helix rail guns are spinning with 'rotator' animation. As a separate problem I noticed that the Simple gun body should also be spinning but it isn't and I haven’t got that to work yet.

I like the idea of having a spinning “turbine” to choose from; although turning 180 degrees one way, then 180 degrees every 12 seconds (our time) is rather a modest spin. Let’s create a non-stop one way direction spin animation and then see what revs these blades are good for. The Rings may look good with blades which sound like perfect drone fan lifters.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Mon Jun 03, 2019 8:31 pm

There is a different Animator that you have to use to get a one-way rotation. The G3D.RotateAnimator class can be used.

var animator = new G3D.RotateAnimator( target, axis, angle, frequency );

Where:
target is the name of a part on the Model, e.g. 'body'
axis is the axis to rotate around, e.g. new THREE.Vector3( 0, 1, 0 )
angle is the amount to rotate in radians, e.g. Math.PI/2
frequency is the number of times per second that it will make that rotation, e.g. 5

Note that I have recently created some constants that will be useful here. When you need a Vector3 that is not going to be modified, such as an axis for an angle, you can use these constants:

G3D.ZERO
G3D.X_AXIS
G3D.Y_AXIS
G3D.Z_AXIS
G3D.NEG_X_AXIS
G3D.NEG_Y_AXIS
G3D.NEG_Z_AXIS

Even though I call them constants, there is nothing constant about them. That is, the system will not stop you from altering them, but we must stop ourselves from doing so or it will cause trouble anywhere else that these values are used.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Mon Jun 03, 2019 9:30 pm

You may have noticed that I have been updating the documentation in the code a bit lately. This is to get it ready for the documentation to be generated from the source code. When that is done, I will be able to write some tutorials that become part of that documentation. Making it easier for you to figure out what you can use, where to use it, and how to use it. It just takes a bit of effort to get the code up to scratch first.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Tue Jun 04, 2019 6:42 pm

.
Yes, I've noticed you've left very clear descriptions in the code lately. Thanks.

Virtual Scattering Application - Page 2 Spray10
Simple gun back and forth spin missing problem. Ok, easy fix. One may not specify a start angle of zero and an end angle of zero - such as some multiple of 2*Math.PI. Changed from 2*Math.PI to Math.PI
/////\\\\\/////\\\\\/////\\\\\/////\\\\\

Attempting to add a constant one way spin (rotateAnimator) to Helix. I'm stuck. As I understand it, I believe we need to add the desired animation to the model: scattering-gun-gen.js Lines 668-671:
Code:
this.axis = G3D.Y_AXIS;
this.angle = 2*Math.PI;
this.frequency = 1; // Hz
//animator = new G3D.RotateAnimator( 'body', this.axis, this.angle, this.frequency );

Removing the  //  from line 671 results in an error at line 817.
Code:
var anim = animator.clone();
anim.removeAllDelegates();// line 817
anim.phase = -(i+1)*pulseWaveFactor;

TypeError: anim.removeAllDelegates is not a function.

I tried removing any other animation, and adding a var in front of the only animator but it made no difference. I decided it’s better to ask you.
/////\\\\\/////\\\\\/////\\\\\/////

Question. this.pulse.frequency. The various WaveFunction types: Sine, Square, Triangle, Sawtooth, InverseSawtooth are listed in g3d-animators.js. I had a question about where was this.pulse before realizing that animator.waveFunction = this.pulse.wave; this.pulse contains the color animation start middle and end points and is defined in the gun classes that need it.  
\\\\\/////\\\\\/////\\\\\/////\\\\\

Two Contra-rotating Fan Sets. I have tried several ways to position two helixs in contra-rotation. No joy. They always spin the same way as if they were both parts of a single spinning object.
Code:

 // create and place the mesh
 var mesh = new THREE.Mesh( geom, mat );
 mesh.rotation.y = Math.PI/2 + i * Math.PI*2/this.ribbonsPerSet;
 //mesh.position.y = this.bodyRadius * f; //
 mesh.position.y = 2*this.bodyRadius; //
 mesh.rotation.x = Math.PI;
 model.parts.body.add( mesh );

 mesh = new THREE.Mesh( geom, mat );
 mesh.rotation.y = Math.PI/2 - i * Math.PI*2/this.ribbonsPerSet;
 //mesh.rotation.x = Math.PI;
 //mesh.rotation.z = Math.PI; // Neither rotation yields contra-rotating fans.
 //mesh.position.y = this.bodyRadius * f; //
 mesh.position.y = -2*this.bodyRadius; //
 model.parts.body.add( mesh
What am I missing?
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Tue Jun 04, 2019 11:17 pm

The animators that swing between values will be using a lerp function. Lerp is used to find 1 value that is between 2 other values given a third value between 0 and 1 inclusive. It looks like this:

var value = lerp( min, max, t );

where t is between 0 and 1.

When t=0, it will return min.
When t=1, it will return max.
Otherwise it will return the value that is (t*100)% between min and max.

Therefore, if you give it min and max values that are equal, then you will only get back that value. It is a bit trickier with angles, because 0° is the same as 360°, so it doesn't rotate at all since it is trying to rotate between 0 and 0.

It catches me out every time I use it. I always setup a rotation between 0 and 360 and get nothing. About a half hour later, I realise what the problem is. It happened just like that just a week ago. Just use a max angle of Math.PI*1.999 as it will be close enough to 360 to be unnoticeable.

Your problems with the RotateAnimator are caused by later code that worked when you weren't using RotateAnimator, but had a WaveAnimator instead. The problem is that you are cloning the animator, but it is not the right type of animator anymore.

Create the RotateAnimator either at the top of all animators, or at the very end. Whichever way you go, make sure that whenever you have animator.clone(), that there is a WaveAnimator object currently set on the animator variable. That is, look at the code above that line, and make sure the there is a line like animator = new G3D.WaveAnimator( ... ). If there is not, then replace the clone line with a call to the constructor.

The removeAllDelegates method is only available on Animators that extend from DelegateAnimator. WaveAnimator does, but RotateAnimator does not. It doesn't make any sense for RotateAnimator to have delegates.

I think you've answered your own question about this.pulse. Let me know if you still have issues.

The contra-rotating fans are not being setup correctly, assuming the above code is all of it (I haven't checked the actual code). The mesh.rotation object is used to set a static rotation. The mesh will be rotated by that amount at all times. It will not create spin, because to do so the angle must change over time. The RotateAnimator class is doing just that. It retrieves the part and changes its rotation property (actually it uses the quaternion) every time it is called, which is every frame.

So you need to setup 2 RotateAnimator instances, one for each mesh and set the rotation angle on the animator to opposite values.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Wed Jun 05, 2019 10:29 pm

.
Another day with little to show for it. Please excuse the report.

Virtual Scattering Application - Page 2 Bradeq10
Bad example. Helix gun. Offered as a possible clue. The close-up is on the right.

Helix gun. I spent time learning the variable list better and added to the comments. One unfortunate find was that as I varied this.bodyRadius I was changing the object’s distance from the center of the target zone - inversely. When this.bodyRadius = f = 20; is entered, all the cardinal objects overlap in the center of the target zone; at the same time, the 8 objects of the 14 position configuration that are miss-oriented are in interesting positions above the center of the target zone. It seemed like a clue to the orientation problem so I included it above.

Each helix gun shown has two 1.45*Math.PI rads long ribbon blades. I wasn’t able to construct shorter edges without the two losing their correct centers of rotation which begin to approach the center of mass – not good. I’ll position the two opposite spinners about this.bodyRadius apart, whatever that means.   

I liked the blue slime and see that’s it’s gone. I haven’t been able to revisit the Norwegian forest due to some error. May I suggest? We need a few deck and overhead alternatives. We need water! Pond, lake, ocean, or deep sea; underground cistern, whatever. Please include a lighter alternative as well.  

Helix gun contra spinners. I'm still after a single spinner. I tried stripping all animators but the RotateAnimator. Nothing’s happening. Feel free to put me out of my misery - if you’d be so kind.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Thu Jun 06, 2019 1:14 am

The blue slime texture still exists (I'm using it in the spiral gun generator). I created a heap of different colors for the slime just by opening the tex in an image editor and changing the hue. If you want to know what textures are available, then look in texture-packs.js. If you are using them as TextureDef objects, then look in texture-defs.js. Actually, scratch that last one, that won't help you anymore, even though that is where you will find them in code. I refactored texture-defs.js to programmatically create the TextureDef object based on what TexturePack objects are available from the texture-packs.js file. So if you find it in the texture-packs.js file, then there will be an equivalent TextureDef for it. But the name will be the common part. An example will help explain it.

The first TexturePack defined is stored as module.Wood.BoltedWoodenPlanks.RES_512. The module object will become TexPax to other code (its global name). So you could refer to that exact TexturerPack with TexPax.Wood.BoltedWoodenPlanks.RES_512. However, a TextureDef contains multiple TexturePack instances that refer to the same texture, but in different sizes. So the name of the TextureDef will be module.Wood.BoltedWoodenPlanks and in this case, module will become TexDef, so you can refer to it as TexDef.Wood.BoltedWoodenPlanks.

If you ever want to know what module is actually called outside of the file it is used in, then go to the top of that file and the very first line (excluding any comments) will be something like this:

var MyModuleName = (function( ... )

In this instance, module in this file would be referenced as MyModuleName outside of this file.

It is a bit confusing, but there are good reasons for doing it that way. Just don't make the mistake of thinking that all module variables are actually the same object. They are only ever referenced as module from within that file and must be referenced by their global name when outside of it. While there are other, and more important, reasons for doing this, the simplest is that it allows me to change the name of the module without having to change references scattered throughout its own file. The other reasons are more technical.

I have seen that grouping at the center behavior before, but I can't remember what caused it. There are all sorts of problems with positioning and rotating the guns at the moment, and I think this problem is in there too. My best guess at the moment is that something is generating an invalid number. Check the values being set on the Model object in the gun generator's createModel method. It may be that one of those, for example the muzzle and/or direction vectors. Look at the other generators and see if they are doing something different and if they work, then try to bring yours inline with those.

With respect to opposite spinning parts, you will need each part to be stored in the Model.parts object with a unique key for each. So it will have something like this in createModel:

// create a mesh
var mesh = ...
model.parts.rotator1 = mesh;
// create another mesh
mesh = ...
model.parts.rotator2 = mesh;

You can put those meshes into any groups that you want, even if those groups have their own animators.

Now you are able to create 2 RotateAnimator objects like this:

var rotator = new G3D.RotateAnimator( 'rotator1', G3D.Y_AXIS, Math.PI, 2 );
model.addAnimator( 'rotator1', rotator );
rotator = new G3D.RotateAnimator( 'rotator2', G3D.Y_AXIS, -Math.PI, 2 );
model.addAnimator( 'rotator2', rotator );

Note that there is another way to reverse a rotation when using an axis angle. You can change the axis and leave the angle the same. So this is equivalent to the above code:

var angle = Math.PI;
var rotator = new G3D.RotateAnimator( 'rotator1', G3D.Y_AXIS, angle, 2 );
model.addAnimator( rotator );
rotator = new G3D.RotateAnimator( 'rotator2', G3D.NEGATIVE_Y_AXIS, angle, 2 );
model.addAnimator( rotator );

A rotation about the opposite axis will rotate the opposite way. This would allows you to specify the angle for both in the same property and just change the axis.

I'll have a look over the code later, but see if that helps you at all.


Last edited by Nevyn on Fri Jun 07, 2019 6:09 pm; edited 2 times in total (Reason for editing : Fixed bug in addAnimator method call which needed the name of each animator.)
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Fri Jun 07, 2019 6:02 pm

I fixed the helix gun and got the rotations working. There was a bug in the RotateAnimator class, so it was never going to work for you. I left some notes in the code to explain what was wrong.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Fri Jun 07, 2019 7:01 pm

.
After several more hours effort, I’d prepared a brief description of my understanding and a miserable request to be put down.

I'm delighted to find that’s no longer necessary, you’ve corrected the problems. Thanks. I study the solution.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sat Jun 08, 2019 6:08 pm

.
Virtual Scattering Application - Page 2 Conspi10
Helix gun. Now with spins.

I decided to try concentric helix sets, adding a new outside helix geometry and material. You can almost see for yourself. Each gun is a whirligig, with three outside ribbons axially spinning clockwise (looking from the outside in to the target) at one speed and three twice as long (axially) inside ribbons spinning faster counter-clockwise. Their motions suggest the axial motion of propellers, one cannot help but see linear motion, an optical illusion. I guess I’ll make a suitable for loop for it. I'd like to marry it to the ring geometry as well.

I forgot to mention that I liked the additions you made to the Ring gun. The neon muzzle color especially. I’ve tried to figure it out several times. You indicated a desire for a wave color change back to front, toward the target center. At present, they don’t quite phase so well; note to self – don’t forget to make it so.

I’m slowly – hope it isn’t painful for you - getting a handle on things. When you changed from Object3D to THREE.Object3D my chrome output went from the routine yellow warnings to 28 red errors.  
4three.js:8551 THREE.Object3D.add: object not an instance of THREE.Object3D. undefined
add @ three.js:8551
I didn’t see what corrected that. Must have been before your g3d-animators change? Having a reliable git interface is nice. SourceTree let’s me know when Pulls need to be made - at any old time. I always fetch first, whether I’ve made changes or not.  

Before I read your code note yesterday I had figured out how to properly include the labels in the addAnimator method. My biggest mistake was not knowing to assign any animation ‘model.parts.rotator1’ as a ‘new THREE.Group()’. I wrote you a question, asking how - I appreciate that answer, thanks.
.

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 08, 2019 6:21 pm

I didn't add anything to the Ring Gun. I hadn't seen that barrel before I just checked. Must have been something else in the code that now allowed it to work correctly. My guess is it was always there, but it wasn't visible or in the right spot for some reason. Don't know, really.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 08, 2019 8:25 pm

I have extracted G3D out into its own project. I was always building that with the idea that it was its own thing, and just using this app as an incubator for it while I fleshed out its structure and usage. I found myself working in another project and wanted some of the code in G3D, so I started to copy little bits into that project. Then more bits, and more bits. Then I was finding bugs in one project and having to fix them in the other. So out it goes.

However, you may need to refer to it at times, since that is where things like Animators and texture classes are declared. So I have given you read access to it on BitBucket. I didn't give you write access, since changes in there will effect other things.

I was forced to change some of your code. It was valid code, you did nothing wrong, but the tool I use to generate documentation didn't like it. So I refactored it to use normal functions for the same job, although it is a bit more complicated now because it lost the reference to this.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by LongtimeAirman Sat Jun 08, 2019 9:44 pm

.
Virtual Scattering Application - Page 2 Curout10
Please excuse the play by play. Here's the current output.

Thanks, I know enough about g3d to not ask for answers, but to find them.
.
P.S. With the last 2 updates - up to 11 minutes ago. TypeError: G3D.TexturePack is not a constructor. High anxiety stuff.

P.P.S.We're good. I see Spiral guns.


Last edited by LongtimeAirman on Sat Jun 08, 2019 10:18 pm; edited 2 times in total (Reason for editing : Added P.P.S.)

LongtimeAirman
Admin

Posts : 2015
Join date : 2014-08-10

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 08, 2019 10:09 pm

I am refactoring G3D because the documentation tool, JSDoc, doesn't like the way I had things working. Well, really, I just couldn't get it to work. It probable can, or I could change some of the ways I was doing it, but in the end I think it is better to separate things out into their own modules. I don't want to fight with it at the moment.

So things are in transition while I iron out the changes in both projects. Keep checking for new commits because I am fixing them up pretty quickly.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Nevyn Sat Jun 08, 2019 10:19 pm

Here is the G3D documentation as generated from the source code. It is still patchy, as it is a work in progress to get it all documented correctly, but it is better than wading through the source code trying to find what you want.

G3D API (login to see link)

If you find something is not documented, or not enough for you to understand it, then just make a request. I have been trying to get the classes documented, but sometimes it is important that the properties of a class be documented to really understand how to use it.
Nevyn
Nevyn
Admin

Posts : 1887
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Virtual Scattering Application - Page 2 Empty Re: Virtual Scattering Application

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 4 1, 2, 3, 4  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum