thumbworks / augmentedsolarsystem Goto Github PK
View Code? Open in Web Editor NEWAn Augmented reality experience to explore planets in our Solar System
An Augmented reality experience to explore planets in our Solar System
Scaling the size of the planets while in a tight orbital rotation allows for the sun to be larger than a few of the first planet's orbital Radius. Should be enforceable.
Seems like I should be able to detect the direction of the arrow. Perhaps it's position relative to the camera. Otherwise determining if the SCNnode is inside of the camera frustum.
Star walk or similar has a link directly to the reviews form.
The session never seems to restart when a phone call interrupts. Probably something with willResignActive
https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622950-applicationwillresignactive
Probably smooch.io
related to #18. Early feedback suggests that more feedback was expected.
I'd written a playground to show the ISS on a map. https://gist.github.com/rodericj/0bf0b70dc8a7faf0cce5a5c52b60d917
Could probably add the ISS model as well: https://3dwarehouse.sketchup.com/model/e6782860a97b8c5662613f502918d6e5/International-Space-Station-ISS
Looking for a function like this:
F(20 meters) = a house
F(10cm) = a baseball
F(1cm) = a pea
Etc
When the sun scales it can become easy to lose one's place if inside of the sun. An indicator that we are inside of a node would make this much more explicit and indicate what the user can do at this point
A suggestion from Delong. He said he wanted to show the planets on a table so he could see them all. I should be able to determine the shortest dimension of the plane, then set Pluto's orbit to that, then calculate the size down from there.
Thanks to @marksands for the feedback on that.
for some reason to be determined - this codebase runs much much faster.
https://github.com/skull8888888/solarSystem
credits - @skull8888888
probably could have a lot to do with much smaller image assets
Currently it's sort of tough to tell that the collection view is actually a collection view. Perhaps a little animated thing so it's a bit more obvious.
Currently shows up truncated on the home screen. This is a 10 second fix
When the app is interrupted the ARKit session is jacked. Need to handle the changes and adjust accordingly.
Sometimes earth spins too quickly. It'd be nice if we could make this slow down to either real time or something else
Something something device capability
Smooch.io probably
DeLong had a great experience except that hshe could see the farther planets. Need to either make a tabletop size or pinch to zoom which might make sense.
They are all here and they look fabulous. Should be pretty straight forward to add these.
On the iPhone it causes the session to get interrupted. Need to do something else here.
https://github.com/johndpope/SwiftGlobe/blob/master/SwiftGlobe/SwiftGlobe.swift#L167
let kTiltOfEarthsAxisInDegrees = 23.5
let kTiltOfEarthsAxisInRadians = (23.5 * Double.pi) / 180.0
let kSkyboxSize = CGFloat(1000.0)
let kTiltOfEclipticFromGalacticPlaneDegrees = 60.2
let kTiltOfEclipticFromGalacticPlaneRadians = (60.2 * Double.pi) / 180.0
// tilt it on it's axis (23.5 degrees), varied by the actual day of the year
// (note that children nodes are correctly tilted with the parents coordinate space)
let calendar = Calendar(identifier: .gregorian)
let dayOfYear = Double( calendar.ordinality(of: .day, in: .year, for: Date())! )
let daysSinceWinterSolstice = remainder(dayOfYear + 10.0, kDaysInAYear)
let daysSinceWinterSolsticeInRadians = daysSinceWinterSolstice * 2.0 * Double.pi / kDaysInAYear
let tiltXRadians = -cos( daysSinceWinterSolsticeInRadians) * kTiltOfEarthsAxisInRadians
//
seasonalTilt.eulerAngles = SCNVector3(x: tiltXRadians, y: 0.0, z: 0)
scene.rootNode.addChildNode(seasonalTilt)
This is fantastic.
Apparently - not all planets fly along same Elliptical Orbital as per app.
https://www.youtube.com/watch?v=nrP4a4MCo8A
will dig into this further and update when I found out more info.
A little bit of issue with the initial tries on this. Should be able to use SwiftAA.
Jbr brought this up in testing. Suggested that arrow was pointed at the wrong place.
In some of the latest betas I'm seeing the app icon seems to not be large enough. Should be simple to fix
Mixpanel probably
Seems like there is a scenario where the session isn’t interrupted when the app goes the the background. Seems like we always want to reset everything properly in these scenarios.
I've spent some days digging through this - with this image - hopefully it will make sense.
https://youtu.be/9XHoVF2G0j8?t=653
http://astro.unl.edu/classaction/animations/coordsmotion/celestialhorizon.html
I think I'm looking to find a camera angle for scenekit which would create a horizon view to universe
I want to make the point of view geocentric.
the horizon which is currently the heliocentric plane - I want to tilt to the declination of earth's orbit - with every planet above the horizon above the scenekit floor / everything below the earth beneath. the universe plane would still spin as it does. (I'm not looking to create star walk - how the view is represented is perfect. )
Not sure how hard this is - I found this function that maybe able to be repurposed.
given a users location / instead of finding the moon - perhaps we can derive a camera angle in scenekit. the point of view - would be geocentric - as the user sees the planets above.
func findMoon(date: NSDate, longitude: Double, latitude: Double) -> (Double,Double,Double)
https://github.com/johndpope/Moon/blob/ui-heading-display/Moon/FindMoonService.swift
let earthNode = PlanetoidGroupNode(planet: Planet.earth)
earthNode.updatePlanetLocation(earthAA.position())
currently these lines map SwiftAA into the scenekit.
however, I don't believe there's any way to get scenekit camera to specific point of latitude / longitude.
this plist contains a bunch of cities with lat / lngs
https://github.com/op1000/EarthTravel/blob/master/EarthTravel/Resources/AllCititesToTravel_258.plist
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"AllCititesToTravel_258" ofType:@"plist"];
NSDictionary* objectData = [NSDictionary dictionaryWithContentsOfFile:filePath];
NSArray* arrayList = [objectData valueForKeyPath:@"list"];
NSMutableArray* arrayCordinate = [[NSMutableArray alloc] init];
for (NSDictionary* dicInfo in arrayList) {
NSString* cityName = dicInfo[@"dest_name"];
float lat = [dicInfo[@"lat"] floatValue];
float lng = [dicInfo[@"lng"] floatValue];
NSString* countryCode = [dicInfo objectForKey:@"country_code"];
// drop some pins
KGLEarthCoordinate *pin = [KGLEarthCoordinate coordinateWithLatitude:lat
andLongitude:lng
andPinIdentifier:cityName
andConturyCode:countryCode];
[arrayCordinate addObject:pin];
}
[self dropPinsAtLocations:arrayCordinate];
-(void)dropPinsAtLocations:(NSArray *)pinArray
{
// remove any existing pins
for (SCNNode *node in _currentPins) {
[node removeFromParentNode];
}
_currentPins = [NSMutableArray array];
// create new pins
for (KGLEarthCoordinate *coord in pinArray) {
KGLPinNode *newPin = [KGLPinNode pinAtLatitude:coord.latitude
andLongitude:coord.longitude
title:coord.pinIdentifier
countryCode:coord.contryCode];
if (coord.pinIdentifier) {
newPin.identifier = coord.pinIdentifier;
}
[_shadedNode addChildNode:newPin];
[_currentPins addObject:newPin];
}
/*!
* @discussion Convenience method for creating a pin, with internal nodes set up, at a specified location, assuming an Earth at the center of the scene with a radius of 50 units.
* @param latitude The pin's latitude, in degrees.
* @param longitude The pin's longitude, in degrees.
* @return An instance of the KGLPinNode class.
*/
+ (KGLPinNode *)pinAtLatitude:(float)latitude
andLongitude:(float)longitude
title:(NSString*)title
countryCode:(NSString*)countryCode
{
KGLPinNode *pin = [super node];
if (pin) {
pin.latitude = latitude;
pin.longitude = longitude;
pin.countryCode = countryCode;
}
pin.name = @"pinWrapper";
SCNBox* pinScene = [SCNBox boxWithWidth:1.0 height:1.0 length:1.0*108.0/159.0 chamferRadius:0];
//SCNPyramid* pinScene = [SCNPyramid pyramidWithWidth:1.0 height:1.0 length:1.0];
SCNNode *pinNode = [SCNNode nodeWithGeometry:pinScene];
NSString* strCountryImagePath = [NSString stringWithFormat: @"icon_%@", countryCode];
{
// ambient light
SCNMaterial *greenMaterial = [SCNMaterial material];
greenMaterial.diffuse.contents = [UIColor clearColor];
greenMaterial.locksAmbientWithDiffuse = YES;
SCNMaterial *redMaterial = [SCNMaterial material];
redMaterial.diffuse.contents = [UIColor clearColor];
redMaterial.locksAmbientWithDiffuse = YES;
SCNMaterial *blueMaterial = [SCNMaterial material];
blueMaterial.diffuse.contents = [UIColor clearColor];
blueMaterial.locksAmbientWithDiffuse = YES;
SCNMaterial *yellowMaterial = [SCNMaterial material];
yellowMaterial.diffuse.contents = [UIColor clearColor];
yellowMaterial.locksAmbientWithDiffuse = YES;
SCNMaterial *purpleMaterial = [SCNMaterial material];
purpleMaterial.diffuse.contents = strCountryImagePath; // 위를 쳐다보는 면
purpleMaterial.locksAmbientWithDiffuse = YES;
SCNMaterial *magentaMaterial = [SCNMaterial material];
magentaMaterial.diffuse.contents = [UIColor clearColor];
magentaMaterial.locksAmbientWithDiffuse = YES;
pinScene.materials = @[greenMaterial, redMaterial, blueMaterial,
yellowMaterial, purpleMaterial, magentaMaterial];
}
// add the pin geometry to the pin node
[pin addChildNode:pinNode];
// pins are small, especially from directly above or zoomed out, so wrap a larger rectangular node around the pin
// this will create a greater touch area
SCNBox *touchBrick = [SCNBox boxWithWidth:5.0f height:7.5f length:5.0f chamferRadius:0];
SCNNode *touchNode = [SCNNode nodeWithGeometry:touchBrick];
touchNode.hidden = YES;
touchNode.name = @"TouchPin";
[pin addChildNode:touchNode];
// position the pin
// calculate the pin's position along the Y axis of the Earth, based on the given latitude
float yPos = sinf(DEGREES_TO_RADIANS(latitude)) * 27.8f*ZOOME_RATIO;
// calculate what the radius of the horizontal circle that cuts through the Earth is at the given Y position
float localRadius = [KGLEarthCommonMath radiusOfCircleBisectingSphereOfRadius:27.8f*ZOOME_RATIO atHeight:yPos];
// using the local radius, calculate the X and Z positions of the pin, based on the given longitude
HorizontalCoords coords = [KGLEarthCommonMath horizontalCoordinatesAtDegrees:longitude ofSphereRadius:localRadius];
pin.position = SCNVector3Make(-1 * coords.x, yPos, coords.z);
// rotate the pin so it stands vertically at 90 degrees from the surface of the Earth
// first, set the pin's euler angles such that it lies flat against the surface of the Earth, given the pin's location
// the yaw angle positions the pin so it faces out from the surface of the Earth at its location
float yawAngle = atan2f(-1 * coords.x, coords.z);
// the pitch angle tilts the pin so it lies on the ground
float pitchAngle = -1 * DEGREES_TO_RADIANS(latitude) - M_PI_2;
pin.eulerAngles = SCNVector3Make(pitchAngle, yawAngle, 0);
// now rotate the pin by 180 degrees vertically, so it stands up
SCNMatrix4 latRotation = SCNMatrix4MakeRotation(DEGREES_TO_RADIANS(180),1, 0, 0);
pin.transform = SCNMatrix4Mult(latRotation, pin.transform);
//==============================
// label
//==============================
SCNText *text = [SCNText textWithString:title extrusionDepth:0.1];
SCNMaterial *magentaMaterial = [SCNMaterial material];
magentaMaterial.diffuse.contents = [UtilManager colorWithHexString:@"ec4f30"];
magentaMaterial.locksAmbientWithDiffuse = YES;
text.materials = @[magentaMaterial];
SCNNode *textNode = [SCNNode nodeWithGeometry:text];
textNode.position = SCNVector3Make(-1+M_PI_2, 0, 0);
textNode.transform = SCNMatrix4Mult(SCNMatrix4MakeScale(0.05, 0.05, 0.05), textNode.transform);
[pin addChildNode:textNode];
return pin;
}
}
A simple cylinder and a cone looks pretty good. Use this and an SCNLookatConstraint, add a label and we've got everything we need.
This guy seems to have gotten it: https://github.com/miliPolo/ARSolarPlay
Currently this just gets the first plane it sees and goes from there, need to adjust as the understanding of the environment changes.
The scale of the Solar System is the interesting part of this whole experiment. Let's add an option to show the proper scale of things. Since some planets would be obnoxiously small, may need to add some labels and hints as to where things are if they are too small.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.