Sign in to follow this  
iiceman

Are actions possible for sprites?

Recommended Posts

Hey guys, I was working on a little project and would like to have some click actions on a sprite. But somehow it doesn't work. Is it not meant to work? And if not, why? :P

 

Using actions would be cool because I am not sure yet if I only need clicking or maybe some other stuff, too, and actions make it pretty easy. Just wanna make sure it's not me being stupid and just using it wrong :D

 

Example: can click sphere, can't click player sprite: http://www.babylonjs-playground.com/#9RUHH

Share this post


Link to post
Share on other sites

Hi Ice!  (and Hi DK!)

 

Ice... I suppose you'll want clickable particles next, eh?  :D

 

http://www.babylonjs-playground.com/#9RUHH#2

 

Works fine.  pffft.  What's wrong with you guys?  :)

 

(My PG above is a terrible kludge/fight-around.  hehe.  If you move your sprites, you will have to move the action-active ghost that's behind them, too.)

Share this post


Link to post
Share on other sites

@Deltakosh: no big deal, there are so many possible workarounds, I'll find something for sure

 

@Wingy: yeah, that might actually be the easiest solution. And no, its not for particles... at least not this time ;) It's for the panorama viewer thingy: http://p215008.mittwaldserver.info/panorama360/#scene1 just something very simple to click on to get to the next room. I already had it working with the green spheres (can't click them anymore at the moment because the sprites are in the way ... I guess). I'll try the ghost solution.. or I just use planes. Just wanted to make sure that it actually jsut not implemented (yet) :D

 

By the way: since you can't click the moment: just use the hash parameter to see the otehr scenes... it's 1 to 4. But really nothing special to see except the house and the garden :P

Share this post


Link to post
Share on other sites

Beautiful scene1, Ice!!  I qualified for medicare waiting for it to load, but it was worth the wait/weight.  :)  #scene3 seemed to "hang" when I tried it... never finished loading, and I didn't try #scene2/4 yet... but I will... someday.  What an interesting project, I-man!  Way nICE.

Share this post


Link to post
Share on other sites

:D

 

Actually, I did 9 years in the US Air Farce... as an electronics tech on "crypto" (data enciphering) widgets.  So, I can lay back into ObamaCare's easy inclusion of us vets, via the VA medical facilities.  Unfortunately, closest one is 135 miles away, but I can go to local civilian places, too, as long as I tell them "Don't fix anything that the VA won't pay-for."  :D  Sigh.  Yay America!  (oh boy)

 

Hey Icewalker... what the heck mesh is your panorama being mapped-onto?  Can you gather pick locations by putting an AM on IT?

Share this post


Link to post
Share on other sites

:lol:

In France, he could have done some administrative procedure at the Secu meanwhile !

 

@iiceman :

maybe you could use a billboarded textured quad (CreatePlane) => ever facing the cam like a sprite, but being a real mesh, so pickable

Share this post


Link to post
Share on other sites

You guys are fun :D Kinda glad to live in Germany: efficient public services as well as a great health care system ;)

 

Is the loading time really that bad? Hmm... that's not good... maybe I can reduce the quality of the images a bit more. They are between 1MB and almost 6MB I think, I try to get them all to 1MB.

 

 

Hey this is great! I would love to showcase it on babylonjs homepage when it's done !

That would be cool! Problem is that I don't own the images. I prepare a version with license free images (if I find something) as soon as everything is working. Or I might ask the owner of the images. It is for a German hotel on the island Rügen, maybe we can leave a link to their web page in the demo. I don't think they mind me using there pictures if it's free advertisement :P I plan on finishing it tomorrow, I let you know how it went ;)

 

 

maybe you could use a billboarded textured quad (CreatePlane) => ever facing the cam like a sprite, but being a real mesh, so pickable

Yeah, that sounds pretty good. Gonna try that tomorrow!

 

 

Hey Icewalker... what the heck mesh is your panorama being mapped-onto?  Can you gather pick locations by putting an AM on IT?

Uhm uhm... not sure what you mean... it's mapped on a sphere. I can do pick locations... I think it currently does if you look at the console... I used that to place the "doors". But waht you you mean with "AM"? I am confused and I think my brain is already at sleep :P

 

 

Or you can use bgui!

I might try that in an extra version. Always wanted to try it out!

 

 

Thanks for all your comments guys, it really helps to get some feedback. Thanks a lot! :)

Share this post


Link to post
Share on other sites

AM = actionManager  :)  sorry

 

But you don't really need an actionManager on the sphere, at all.  (You already know that, and I'm just catching up.)

 

You want to click certain areas of the panorama, and stuff happens when you do?  Heck yeah, sphere.onPick = clickLocationAnalyzerAndJumpTableFromHell(pickingInfo)... easy as pie, piece of cake.  :o  (I'm speaking in pseudo-code here, your mileage may vary.)

 

In other words, you assign various areas of the sphere's texture... to links.  Click the door, out you go.  Click a bottle, bottle model, etc.  You would need to process the pickingInfo texture coordinates in a way similar-to an html areaMap (formerly known as an ISMAP).  *shrug*  Maybe you are already doing that, but not triggering activities based-upon WHERE the click happened... yet.  :)

 

And maybe... hmm... maybe you should think about the merits of a decal.  It IS a mesh... but I have never seen anyone try to put a decal on the inside of a sphere.  But, decals are mesh... so... they should be able to take an actionManager.  Prepare for tumors... as it is quite unlikely that a decal will be able to curve-match the sphere's inside contour.  But maybe.

Share this post


Link to post
Share on other sites

Okay, I tried using the plane with billboard mode but a problem appeared: http://p215008.mittwaldserver.info/panorama360/#scene1

 

I have this automatic rotation where the sphere that has the environment text rotates slowly. Before I parented the clickable meshes to this sphere and they rotated with it. But in billboard mode it seems like they don't. Is that behavior on purpose or am I doing something wrong here?

 

Nevermind... found another solution and it's looking good now: http://p215008.mittwaldserver.info/panorama360/#scene1

Share this post


Link to post
Share on other sites

Beautiful, IceCreamMan! 

 

Hey viewers... for fastest results... directly browse the 4 pictures first, to get them into your browser cache.  Then hit that final url to the scene itself.

 

http://p215008.mittwaldserver.info/panorama360/img/app7.jpg

http://p215008.mittwaldserver.info/panorama360/img/app7_kitchen.jpg

http://p215008.mittwaldserver.info/panorama360/img/garden1.jpg

http://p215008.mittwaldserver.info/panorama360/img/garden2.jpg

 

http://p215008.mittwaldserver.info/panorama360/#scene1

 

:)  Big pics.  Around 2 minute load time when changing rooms, otherwise (for me). 

 

It sure is pretty.

Share this post


Link to post
Share on other sites

Hmm - shouldn't they get preloaded automatically? 

var remainingAssetsManager = new BABYLON.AssetsManager(scene);		for(var j = 0; j < scenes.length; j++){			if(!scenes[j].preloadedImage) {				var newTask = remainingAssetsManager.addTextureTask('scene with array id ' + j + ' image task', scenes[j].image);				newTask.sceneId = j;				newTask.onSuccess = function (task) {					scenes[task.sceneId].preloadedImage = task.texture;					console.log('loading of scene with array id ' + task.sceneId + ' done', scenes[task.sceneId].preloadedImage);				};			}		}

Seems to work well with me - smooth transition to all scenes.

Share this post


Link to post
Share on other sites

I was still working on that, it still had a few problems... but just finished it :D I hope it works well now... every testing and feedback is welcome.

 

I now load the first texture and when everything is running I prepare the other textures with another AssetsManager. When you try to go to another room it will show you a small loading message if that room hasn't finished loading yet, if it is already done loading you get there pretty much instantly...at least that's how it's supposed to work, no page reloading anymore now :D

 

@Wingy: I still can't believe it takes 2 minutes for one of those images to load... what kind of connection are you stuck with? One of those cool dial up 56k modems from back in the days? ;)

Share this post


Link to post
Share on other sites

It takes 2 minutes when loading it via the in-scene click. 

 

When directly-browsing one of your pictures (such as one of those 4 links), it takes... oh...  5 secs.

 

And I have BLAZING internet speeds, here, actually.  Sometimes... I'll be downloading some file, and suddenly the End-Of-File arrives... and there's a loud bang... and my monitor tips over from the inertia!  :)

 

Correction:  I cleared my cache properly, and re-tested.  67 secs to load http://p215008.mittwaldserver.info/panorama360/img/app7.jpg outside-of the scene. With a cleared cache... the initial scene takes 2:25 to load.  It is over a minute before the screen turns black and the BJS eyeball appears.  Then, 90 secs later... the scene renders.  Domain lookup time was insignificant... it was almost instantaneous, so that was not a contributing factor.

Share this post


Link to post
Share on other sites

By the way, the final version of the 360 degrees panorama viewer can be found here: http://www.villa-aesculap.de/unser-haus/360-panoramen/

 

The first one has doors/links to the other scene, the second and third one are just individual scenes.

 

@Deltakosh: do you still wanna link it on the babylon page? If so: is that link okay or do you need anything else? If not... well, then not, just let me know :P

Share this post


Link to post
Share on other sites

Hey Ice... wanna know what I think?  (A resounding "NO" is heard from the audience).  :)

 

That commercial site is OK for showing your stuff, and you did a fine job, but it should have YOUR name on it exclusively.  (imho)

 

Have you seen the skybox tour that I bribed Deltakosh into giving me a "third party" slot - for?  It has various selectable skyboxes, plus ground/cam up/down hotkeys, models on/off hotkey, floor/ground on/off hotkey, lights on/off option, scene reset choice, etc.  It is sort-of a skybox test lab.  Maybe... you should make something in the same vein.  Maybe Iceman's Panorama Learning Center?

 

By chance, are you photographing/creating these pano images yourself?  That would be even cooler, because YOU would hold all the rights to the pano images in your new demo. 

 

I don't know.  Just thinking.  I'm sort of wishing that we had Iceman's Panorama Workshop... where you would show some great panos, and teach us what you learned about image sizes, types of images, power of two, best sphere sizes, best camera types, how to make clickable areas, etc etc.  Panoramas seem hot hot hot.  People really like them, and you could be our panorama superhero.  And, I think "the workshop" would show-off your skills better than that commercial site.

 

I apologize if I am out-of-line... but I know how excellent you are at LOTS of 3D things, Ice... and I don't think that commercial site shines enough light on YOUR skills and knowledge, and it doesn't have your name on it enough.  It's a nice enough site, and you did a fine job on its panos... but... very few credits to you, and not near enough demented panorama experiments are allowed there.  :)

 

I think you should build Iceman's Panorama Laboratory and give us some knobs to play-with, and maybe a url field where users can try various web-found pano-pics.  Sphere-size expand/contract, camera positioning within the sphere, decals (with/without action managers attached), on and on.  There's lots of "toys" that could get involved with panos... and you already have a sweet starter kit for something MUCH more empowered.

 

Just Wingy's random thoughts.  Your call, of course.  Hope you're well.

Share this post


Link to post
Share on other sites

I am just a small worker ant doing my job :P I was happy to use the fun tools I usually only play with at home to finally do some real work (with money and all that). So no need to get any spotlight on it. It's no big deal anyways... just a few lines of code and a lot of experimenting. From time to time I think about starting a blog ( I even believe I have one registered at blogger or something :P), but then I don't have time or mood writing stuff there. Writing code is so much more fun than writing text, or going outside or talking to people :P

 

But I like the thought of making it more configurable and adding some check boxes so that people can try things out. I'll give that a shot, I think!

 

I don't make the pictures myself. I make some pictures (and my girlfriend makes aloooot of pictures). So it would be cool to create some panoramas on my own... but I actually don't know how to transform them into spherecal textures... but how hard can that be, right? :D

 

 

 

Have you see the skybox tour that I bribed Deltakosh ...

 

I don't think I have seen it yet... where can I find it?

 

Sooo... I get what you are saying and you are right. It sure has potential and to play around with it a bit more would be fun. So yeah, I consider making a little panorama lab and maybe write a forum post about it! But no need for extra credit or something. If I want fame I learn typescript and start contributing to babylon to get my name on the contribute list (by making the tiniest contribution needed to get on that list)! :D

Share this post


Link to post
Share on other sites

Ahh, you always sell yourself short.  You're a big dog, Ice!  The kids all look-up to you!  :)

3delyvisions SKYBOX TOUR is the last demo on the main website.  3delyvisions had a pile of "use us" skybox textures and I grabbed them all and renamed them properly to become Babylon skyboxes, and then made a little "test lab" and touring system.  (You see, I still hold the record for the tiniest contribution needed to get on that list)  heh.

Just for fun, there's some interesting panography here...  http://www.emanueleferonato.com/wp-content/uploads/2014/12/360/

  (hit a key to advance to next pano)

And I did one once:  http://playground.babylonjs.com/#A4BMF#4

I also tried layers:  http://playground.babylonjs.com/#1XQKP1#9

   (sorry for the weird camera.angularSensibility there)

And I did a sphere of stars, too, but I broke the playground for that, and I haven't fixed it yet.

Yep, there was a whole "era" of "backgrounds" I went through, back in the seventies.  Oh wait, it was just last year.  :)

The skyboxes and the panos were the most popular of all methods, and panos are much easier to work-with and have no corner distortions.

But few people get to experiment with the knobs WHILE viewing the pano, especially camera ped up/down, and sphere expand/contract.  But there's also fun knobs like texture UVW wraps, scales, angs, offsets, and texture levels... and when to use emissiveColor instead of diffuseColor... all sorts of fun knobs and buttons.

AND, you drive Babylon.Animations pretty well... so maybe your buttons can do funny things when clicked... animated things... things to add a little extra fun to the panography workshop.  Maybe no big deal for you, but oh... panoramas have a very bright future in 3D land.  Hot hot hot.

Share this post


Link to post
Share on other sites

The first panography (I like that, that sounds dirty :D ) is done with Three.js... boohoo for that ;) ... but I think I found that, too, when researching if something already exists that could be useful. But very nice images indeed!

 

Yours is already pretty much I did, I think. Just added some stuff for loading more images and and some clickable areas.

 

The layering sounds interesting. I imagine something like parallax panoramas... that could be pretty cool! You are really getting me into this, you know. I think I have some time the next 2 or 3 days... so as soon as I am happy with my October challenge maze I take a shot at the panography lab!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.