Comments (11)
It's exactly the same. Just place your model's root node in the PICKING
layout. Then catch it with the mouseClick
signal.
from minko.
Hi @warrenseine, I have this simple code:
auto daeModel = sceneManager->assets()->symbol(DAE_MODEL);
daeModel->layout(scene::BuiltinLayout::DEFAULT | scene::BuiltinLayout::PICKING);
root->addChild(daeModel);
root->addComponent(Picking::create(camera, false, true));
pickingMouseClick = root->component<Picking>()->mouseClick()->connect([=](scene::Node::Ptr node)
{
std::cout << "Mouse Click: " << node->name() << std::endl;
}
Clicking it's not working...
from minko.
Sounds like the right way to do it. Does it work in your code if you replace the Collada model by a simple native shape?
from minko.
Yes working with simple native shapes on branch master
auto ground = scene::Node::create("ground")
->addComponent(Surface::create(
geometry::QuadGeometry::create(sceneManager->assets()->context()),
material::BasicMaterial::create()->diffuseColor(vec4(1.f, .5f, .5f, 1.f)),
sceneManager->assets()->effect("effect/Phong.effect")))
->addComponent(Transform::create(scale(vec3(4.f)) * rotate(static_cast<float>(-M_PI_2), vec3(1.f, 0.f, 0.f))))
->layout(scene::BuiltinLayout::DEFAULT | scene::BuiltinLayout::PICKING)
;
root->addChild(ground);
from minko.
auto daeModel = sceneManager->assets()->symbol(DAE_MODEL);
daeModel->layout(scene::BuiltinLayout::DEFAULT | scene::BuiltinLayout::PICKING);
Picking is done using a GPU picking map rendered by a Renderer
working on all the Surface
components that are in the scene::BuiltinLayout::PICKING
layout. So I think you need to add the meshes to the scene::BuiltinLayout::PICKING
layout, not just the root of the model.
You can define your own file::Options::nodeFunction
that will be called on all node upon loading to make sure the relevant ones are in the right layout:
fileOptions->nodeFunction([](scene::Node::Ptr n)
{
if (n->hasComponent<component::Surface>())
n->layout(n->layout() | scene::BuiltinLayout::PICKING);
}
// load the dae with those options
from minko.
Thanks @promethe42 I will try this code and comment later.
from minko.
Hi @promethe42 , I have another question, is there a way in minko to set a collision shape like this and make it touchable?
from minko.
There are many things on that picture... what's supposed to be the collision shape?
By "touchable", do you mean clickable with the touchscreen?
from minko.
Hi @promethe42 again, collision shape is the blue-light cube, Of course touchable is clickable :-)
from minko.
Just add the picking component to that shape. What's stopping you?
from minko.
Hi @promethe42 thanks again for your support. One and mainly is my spare time to learn minko (minko is awesome technology) but I have had progress step by step :D
from minko.
Related Issues (20)
- where is minko shaderlab and shaderStudio HOT 5
- minko compile 1 error generated HOT 3
- Collision detection HOT 5
- when will you provide minko3 flash version? HOT 1
- Vulkan API HOT 1
- README Linux section is confuse HOT 2
- Chinese characters cannot display on minko-plugin-html-overlay HOT 3
- Mouse events unusable on MacBook HOT 1
- Integration with UIKit HOT 1
- Invalid NDK Path
- Compile Minko SDK android HOT 4
- CylinderGeometry HOT 1
- Using a webserver in the compiled application for an html overlay
- Has minko been abandaned by original developers? HOT 7
- I want use haxe to reimplement the minko source code. HOT 2
- haxe to reimplement the minko source code. HOT 2
- Android build instructions out of date HOT 1
- Integration into Qt HOT 2
- Any chance of enabling discussions on this repo?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minko.